diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-12-27 12:40:19 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:58 +0100 |
| commit | 4e2ab55d345fd5e5c5d2d5bc56948611b15564d5 (patch) | |
| tree | c6998ac54687c442ad0baa541edd0fbf917b1308 /go/client/startMenu.go | |
| parent | 5aa8e7ddbc41aed55e7918e6afaec0b5c07fa510 (diff) | |
| download | muhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.tar.gz muhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.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()) |
