Save state for every game between sessions
A game against the computer is kept as it is played (the host's true state plus its table config, one file per game) and can be resumed from the main menu or the game's setup screen. Leaving keeps the position; End game discards it; a finished game is not kept; a networked table is not saved. MatchController gains restore() and an onHostState listener; MatchSaver writes off the main thread and flushes on leaving and ON_STOP. Tests cover the store, the saver, resuming, and a save/resume round trip of every game in the catalogue at every move. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016eTor2tpxKb4dXbd8RqnvZ
This commit is contained in:
@@ -14,7 +14,9 @@ import org.prolibertate.games.ui.AppEnv
|
||||
import org.prolibertate.games.ui.AppRoot
|
||||
import org.prolibertate.games.ui.theme.ProLibertateTheme
|
||||
import org.prolibertate.games.update.Updater
|
||||
import java.io.File
|
||||
import java.util.UUID
|
||||
import org.prolibertate.games.game.engine.SavedGameStore
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
@@ -40,6 +42,7 @@ class MainActivity : ComponentActivity() {
|
||||
deviceId = peerId,
|
||||
),
|
||||
peerId = peerId,
|
||||
saves = SavedGameStore(File(filesDir, "saved-games")),
|
||||
)
|
||||
|
||||
setContent {
|
||||
|
||||
Reference in New Issue
Block a user