/** ** Load a game to file. ** ** @param filename File name to be loaded. */ void LoadGame(const std::string &filename) { // log will be enabled if found in the save game CommandLogDisabled = true; SaveGameLoading = true; //Wyrmgus start // SetDefaultTextColors(FontYellow, FontWhite); SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor); //Wyrmgus end LoadFonts(); LuaGarbageCollect(); InitUnitTypes(1); LuaLoadFile(filename); LuaGarbageCollect(); PlaceUnits(); const unsigned long game_cycle = GameCycle; const unsigned syncrand = SyncRandSeed; const unsigned synchash = SyncHash; InitModules(); LoadModules(); GameCycle = game_cycle; SyncRandSeed = syncrand; SyncHash = synchash; SelectionChanged(); }
/** ** Load a game to file. ** ** @param filename File name to be loaded. */ void LoadGame(const std::string &filename) { //Wyrmgus start CleanPlayers(); //clean players, as they may not have been cleansed after a scenario CurrentCustomHero = nullptr; //otherwise the loaded game will have an extra hero for the current custom hero //Wyrmgus end // log will be enabled if found in the save game CommandLogDisabled = true; SaveGameLoading = true; //Wyrmgus start // SetDefaultTextColors(FontYellow, FontWhite); SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor); //Wyrmgus end LoadFonts(); //Wyrmgus start InitPlayers(); //Wyrmgus end LuaGarbageCollect(); InitUnitTypes(1); //Wyrmgus start CalculateItemsToLoad(); //Wyrmgus end LuaLoadFile(filename); LuaGarbageCollect(); PlaceUnits(); const unsigned long game_cycle = GameCycle; const unsigned long long current_total_hours = CDate::CurrentTotalHours; const unsigned syncrand = SyncRandSeed; const unsigned synchash = SyncHash; InitModules(); LoadModules(); GameCycle = game_cycle; CDate::CurrentTotalHours = current_total_hours; SyncRandSeed = syncrand; SyncHash = synchash; SelectionChanged(); }