From f3e085ceccd95899d8d705a28266003709ab87b7 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 4 Jul 2025 09:20:48 -0400 Subject: 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. --- go/client/game.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'go/client') 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 + } } } -- cgit v1.2.3