aboutsummaryrefslogtreecommitdiff
path: root/go/client
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-04 09:20:48 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:23 +0200
commite4ec9266c205120a51dc8d5c4ac956f2b8792f1b (patch)
tree89456898db852153785cc11a161f1feb57d3d84a /go/client
parent507f09757ca751c5dc7a1e5ca7ab17ee4715e719 (diff)
downloadmuhqs-game-e4ec9266c205120a51dc8d5c4ac956f2b8792f1b.tar.gz
muhqs-game-e4ec9266c205120a51dc8d5c4ac956f2b8792f1b.zip
refactor playerControl
Allow to propagate errors in order to handle them acordingly. Use playerNotifications by value to reduce the amount of allocations. Add session managment playerNotifications. Support marshalling notifications to plain text.
Diffstat (limited to 'go/client')
-rw-r--r--go/client/game.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/go/client/game.go b/go/client/game.go
index c0724547..7c54ac0f 100644
--- a/go/client/game.go
+++ b/go/client/game.go
@@ -449,8 +449,11 @@ func (g *Game) passPriority() {
}
func (g *Game) handlePlayerNotifications() {
- n := g.playerCtrl.RecvNotification()
- for n != nil {
+ n, err := g.playerCtrl.RecvNotification()
+ if err != nil {
+ // FIXME
+ }
+ for n.Valid() {
log.Println("Received", n)
switch n.Notification {
case game.PriorityNotification:
@@ -493,7 +496,10 @@ func (g *Game) handlePlayerNotifications() {
g.stateBar.ForceRedraw()
g.handLayer.ForceRedraw()
- n = g.playerCtrl.RecvNotification()
+ n, err = g.playerCtrl.RecvNotification()
+ if err != nil {
+ // FIXME
+ }
}
}