aboutsummaryrefslogtreecommitdiff
path: root/go/game/playerControl.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-06-06 21:04:09 -0500
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-03 22:01:22 -0400
commitac17d110ce1d8d6660c26a2fef39dc76c5c160ef (patch)
tree09120b5b132cf6dc364512b80496da9ba808f73f /go/game/playerControl.go
parent6ffc381407883a3db743e5493f99e8bc331cbdc5 (diff)
downloadmuhqs-game-ac17d110ce1d8d6660c26a2fef39dc76c5c160ef.tar.gz
muhqs-game-ac17d110ce1d8d6660c26a2fef39dc76c5c160ef.zip
make PlayerControl a Closer
Diffstat (limited to 'go/game/playerControl.go')
-rw-r--r--go/game/playerControl.go7
1 files changed, 6 insertions, 1 deletions
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)