public static void CheckVersionAndLoadGame(string saveFileName) { PreLoadUtility.CheckVersionAndLoad(GenFilePaths.FilePathForSavedGame(saveFileName), ScribeMetaHeaderUtility.ScribeHeaderMode.Map, delegate { GameDataSaveLoader.LoadGame(saveFileName); }); }
public static void LoadGameFromSaveFile(string fileName) { string str = GenText.ToCommaList(from mod in LoadedModManager.RunningMods select mod.ToString(), true); Log.Message("Loading game from file " + fileName + " with mods " + str); DeepProfiler.Start("Loading game from file " + fileName); Current.Game = new Game(); DeepProfiler.Start("InitLoading (read file)"); Scribe.loader.InitLoading(GenFilePaths.FilePathForSavedGame(fileName)); DeepProfiler.End(); ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, true); if (Scribe.EnterNode("game")) { Current.Game = new Game(); Current.Game.LoadGame(); PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName); DeepProfiler.End(); } else { Log.Error("Could not find game XML node."); Scribe.ForceStop(); } }
public static void LoadGameFromSaveFileNow(string fileName) { string str = (from mod in LoadedModManager.RunningMods select mod.ToString()).ToCommaList(); Log.Message("Loading game from file " + fileName + " with mods " + str); DeepProfiler.Start("Loading game from file " + fileName); Current.Game = new Game(); DeepProfiler.Start("InitLoading (read file)"); Scribe.loader.InitLoading(GenFilePaths.FilePathForSavedGame(fileName)); DeepProfiler.End(); try { ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, logVersionConflictWarning: true); if (!Scribe.EnterNode("game")) { Log.Error("Could not find game XML node."); Scribe.ForceStop(); return; } Current.Game = new Game(); Current.Game.LoadGame(); } catch (Exception) { Scribe.ForceStop(); throw; } PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName); DeepProfiler.End(); }
public static void SaveGame(string fileName) { try { SafeSaver.Save(GenFilePaths.FilePathForSavedGame(fileName), "savegame", delegate { ScribeMetaHeaderUtility.WriteMetaHeader(); Game target = Current.Game; Scribe_Deep.Look(ref target, "game"); }, Find.GameInfo.permadeathMode); lastSaveTick = Find.TickManager.TicksGame; } catch (Exception arg) { Log.Error("Exception while saving game: " + arg); } }
public static void SaveGame(string fileName) { try { string path = GenFilePaths.FilePathForSavedGame(fileName); SafeSaver.Save(path, "savegame", delegate { ScribeMetaHeaderUtility.WriteMetaHeader(); Game game = Current.Game; Scribe_Deep.Look <Game>(ref game, "game", new object[0]); }, Find.GameInfo.permadeathMode); GameDataSaveLoader.lastSaveTick = Find.TickManager.TicksGame; } catch (Exception arg) { Log.Error("Exception while saving game: " + arg, false); } }