diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-04 09:20:48 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-06 11:49:19 -0400 |
| commit | f3e085ceccd95899d8d705a28266003709ab87b7 (patch) | |
| tree | 30869054b059b2484d44e8caf60d4755fd244318 /go/client | |
| parent | 53ba6a1c0cd020f26d501912320a41e8dc736976 (diff) | |
| download | muhqs-game-f3e085ceccd95899d8d705a28266003709ab87b7.tar.gz muhqs-game-f3e085ceccd95899d8d705a28266003709ab87b7.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.go | 12 |
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 + } } } |
