Safe Haskell | None |
---|
Saving and restoring games and player diaries.
Documentation
saveGameFile :: ConfigUI -> State -> IO ()Source
Save a simple serialized version of the current state. Protected by a lock to avoid corrupting the file.
restoreGame :: ConfigUI -> (FilePath -> IO FilePath) -> Text -> IO (Either (State, Diary, Msg) (Diary, Msg))Source
Restore a saved game, if it exists. Initialize directory structure, if needed.
rmBkpSaveDiary :: ConfigUI -> Diary -> IO ()Source
Remove the backup of the savegame and save the player diary. Should be called before any non-error exit from the game. Sometimes the backup file does not exist and it's OK. We don't bother reporting any other removal exceptions, either, because the backup file is relatively unimportant. We wait on the mvar, because saving the diary at game shutdown is important.
saveGameBkp :: ConfigUI -> State -> Diary -> IO ()Source
Save the diary and a backup of the save game file, in case of crashes. This is only a backup, so no problem is the game is shut down before saving finishes, so we don't wait on the mvar. However, if a previous save is already in progress, we skip this save.