diff options
| -rw-r--r-- | go/game/draft.go | 2 | ||||
| -rw-r--r-- | go/game/kraken.go | 4 | ||||
| -rw-r--r-- | go/game/playerControl.go | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/go/game/draft.go b/go/game/draft.go index 74091f5a..e2056d86 100644 --- a/go/game/draft.go +++ b/go/game/draft.go @@ -94,6 +94,8 @@ type randomDraftAiCtrl struct { func (ctrl *randomDraftAiCtrl) Player() *Player { return ctrl.ai } +func (ctrl *randomDraftAiCtrl) Close() { +} func (ctrl *randomDraftAiCtrl) SendNotification(n PlayerNotification) { ctrl.pack = n.Context.(PileOfCards) diff --git a/go/game/kraken.go b/go/game/kraken.go index fccaa6df..82ae6ccd 100644 --- a/go/game/kraken.go +++ b/go/game/kraken.go @@ -81,6 +81,10 @@ func (c *KrakenControl) Player() *Player { return c.kraken } +func (c *KrakenControl) Close() { + close(c.actions) +} + func (ctrl *KrakenControl) awaitGameStateSync() { ctrl.syncGameState.Wait() ctrl.syncGameState.Add(1) diff --git a/go/game/playerControl.go b/go/game/playerControl.go index bad1a13a..c472f4f0 100644 --- a/go/game/playerControl.go +++ b/go/game/playerControl.go @@ -42,7 +42,7 @@ func (n PlayerNotification) IsPriorityNotification() bool { type PlayerNotification struct { Notification PlayerNotificationType - Context interface{} + Context any Error error } @@ -104,6 +104,7 @@ type PlayerControl interface { Player() *Player RecvAction() Action SendNotification(PlayerNotification) + Close() } type ChanPlayerControl struct { @@ -124,6 +125,10 @@ func (c *ChanPlayerControl) RecvNotification() *PlayerNotification { return nil } } +func (c *ChanPlayerControl) Close() { + close(c.actions) + close(c.notifications) +} func NewChanPlayerControl(p *Player) *ChanPlayerControl { a := make(chan Action) |
