diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-12-27 12:40:19 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:12 +0200 |
| commit | 5fa8f32e9795244188e6088c6f3ac90b03913237 (patch) | |
| tree | 9d1e0af1bf4db1ca7d5a4aeaf046024b6a7bf690 /go/client/startMenu.go | |
| parent | 0594a25d9960c6c574ab24f8ec4d9137ceaa6c8e (diff) | |
| download | muhqs-game-5fa8f32e9795244188e6088c6f3ac90b03913237.tar.gz muhqs-game-5fa8f32e9795244188e6088c6f3ac90b03913237.zip | |
introduce game.State interface abstraction
This allows to not use the internal game state directly from client
code.
Diffstat (limited to 'go/client/startMenu.go')
| -rw-r--r-- | go/client/startMenu.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/go/client/startMenu.go b/go/client/startMenu.go index 94ec3aef..0fc7cbe7 100644 --- a/go/client/startMenu.go +++ b/go/client/startMenu.go @@ -3,7 +3,7 @@ package main import ( "log" - // "muhq.space/muhqs-game/go/game" + "muhq.space/muhqs-game/go/game" "muhq.space/muhqs-game/go/ui" ) @@ -132,17 +132,19 @@ func (m *StartMenu) Layout(width, height int) (int, int) { } func (m *StartMenu) startGame() { + var state game.State if m.remote != "" { log.Fatal("Remote games are currently not implemented") + } else { + state = game.NewLocalState() } - g := newGame(m.app).loadMap(m.mapPath).addActivePlayer(m.playerName, m.startDeck) + g := newGame(m.app, state).loadMap(m.mapPath).addActivePlayer(m.playerName, m.startDeck) if m.mapPath == "the-kraken" { - idx := len(g.gameState.Players) + idx := len(g.gameState.Players()) color := playerColors[idx] - g.gameState.AddKraken() - g.gameState.Players[idx].Color = color + g.gameState.AddNewAiPlayer("kraken", color) } m.app.pushActivity(g.Start()) |
