|
OpenTTD Source 20260721-master-g25ec12c62d
|
Functions related to saving and loading games. More...
Go to the source code of this file.
Data Structures | |
| struct | FileToSaveLoad |
| Deals with the type of the savegame, independent of extension. More... | |
Functions | |
| std::string | GenerateDefaultSaveName () |
| Get the default name for a savegame or screenshot. | |
| EncodedString | GetSaveLoadErrorType () |
| Return the appropriate initial string for an error depending on whether we are saving or loading. | |
| EncodedString | GetSaveLoadErrorMessage () |
| Return the description of the error. | |
| SaveLoadResult | SaveOrLoad (std::string_view filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded=true) |
| Main Save or Load function where the high-level saveload functions are handled. | |
| void | WaitTillSaved () |
| void | ProcessAsyncSaveFinish () |
| Handle async save finishes. | |
| void | DoExitSave () |
| Do a save when exiting the game (_settings_client.gui.autosave_on_exit). | |
| void | DoAutoOrNetsave (FiosNumberedSaveName &counter) |
| Create an autosave or netsave. | |
| SaveLoadResult | SaveWithFilter (std::shared_ptr< struct SaveFilter > writer, bool threaded) |
| SaveLoadResult | LoadWithFilter (std::shared_ptr< struct LoadFilter > reader) |
| bool | SaveloadCrashWithMissingNewGRFs () |
| Did loading the savegame cause a crash? | |
Variables | |
| FileToSaveLoad | _file_to_saveload |
| File to save or load in the openttd loop. | |
| std::string | _savegame_format |
| how to compress savegames | |
| bool | _do_autosave |
| are we doing an autosave at the moment? | |
Functions related to saving and loading games.
Definition in file saveload_func.h.
| void DoAutoOrNetsave | ( | FiosNumberedSaveName & | counter | ) |
Create an autosave or netsave.
| counter | A reference to the counter variable to be used for rotating the file name. |
Definition at line 3417 of file saveload.cpp.
References _settings_client, Autosave, Debug, Error, FiosNumberedSaveName::Extension(), FiosNumberedSaveName::Filename(), GameFile, GenerateDefaultSaveName(), GetEncodedString(), Ok, Save, SaveOrLoad(), and ShowErrorMessage().
Referenced by ClientNetworkEmergencySave().
| void DoExitSave | ( | ) |
Do a save when exiting the game (_settings_client.gui.autosave_on_exit).
Definition at line 3435 of file saveload.cpp.
References Autosave, GameFile, Save, and SaveOrLoad().
Referenced by ConExit(), VideoDriver_Dedicated::MainLoop(), VideoDriver_Null::MainLoop(), and MainWindow::OnHotkey().
| std::string GenerateDefaultSaveName | ( | ) |
Get the default name for a savegame or screenshot.
Definition at line 3444 of file saveload.cpp.
References _local_company, _settings_client, TimerGameTick::counter, TimerGameEconomy::date, GetStringWithArgs(), SanitizeFilename(), Ticks::TICKS_PER_SECOND, and TimerGameEconomy::UsingWallclockUnits().
Referenced by DoAutoOrNetsave(), SaveLoadWindow::GenerateFileName(), and MakeScreenshotName().
| EncodedString GetSaveLoadErrorMessage | ( | ) |
Return the description of the error.
Definition at line 3036 of file saveload.cpp.
References _sl, and GetEncodedString().
Referenced by SaveFileError(), SaveFileToDisk(), and SaveOrLoad().
| EncodedString GetSaveLoadErrorType | ( | ) |
Return the appropriate initial string for an error depending on whether we are saving or loading.
Definition at line 3027 of file saveload.cpp.
References _sl, GetEncodedString(), and Save.
Referenced by SaveFileError(), SaveFileToDisk(), and SaveOrLoad().
| void ProcessAsyncSaveFinish | ( | ) |
Handle async save finishes.
Definition at line 394 of file saveload.cpp.
References _async_save_finish, and _save_thread.
| bool SaveloadCrashWithMissingNewGRFs | ( | ) |
Did loading the savegame cause a crash?
If so, were NewGRFs missing?
Definition at line 350 of file afterload.cpp.
References _saveload_crash_with_missing_newgrfs.
Referenced by HandleCrash(), and HandleCrash().
| SaveLoadResult SaveOrLoad | ( | std::string_view | filename, |
| SaveLoadOperation | fop, | ||
| DetailedFileType | dft, | ||
| Subdirectory | sb, | ||
| bool | threaded ) |
Main Save or Load function where the high-level saveload functions are handled.
It opens the savegame, selects format and checks versions
| filename | The name of the savegame being created/loaded |
| fop | Save or load mode. Load can also be a TTD(Patch) game. |
| dft | The type of file to save or load. |
| sb | The sub directory to save the savegame in |
| threaded | True when threaded saving is allowed |
Definition at line 3328 of file saveload.cpp.
References _do_autosave, _gamelog, _grfconfig, _settings_client, _sl, _sl_minor_version, _sl_version, AfterLoadGame(), Base, Check, ClearGRFConfigList(), ClearSaveLoadState(), TimerGameEconomy::date, TimerGameEconomy::date_fract, Debug, DoLoad(), DoSave(), Error, FioFOpenFile(), GameFile, GetEncodedString(), GetSaveLoadErrorMessage(), GetSaveLoadErrorType(), Load, LoadCheck, MinVersion, Ok, OldGameFile, ReInit, ResetSaveloadData(), Save, Scenario, ShowErrorMessage(), and SlError().
Referenced by _GenerateWorld(), ConSave(), DoAutoOrNetsave(), DoExitSave(), LoadIntroGame(), SaveLoadWindow::OnClick(), openttd_main(), SafeLoad(), StateGameLoop(), and CrashLog::WriteSavegame().
| void WaitTillSaved | ( | ) |
Definition at line 3094 of file saveload.cpp.
|
extern |
are we doing an autosave at the moment?
Definition at line 84 of file saveload.cpp.
Referenced by StatusBarWindow::DrawWidget(), and SaveOrLoad().
|
extern |
File to save or load in the openttd loop.
Definition at line 78 of file saveload.cpp.
Referenced by ConLoad(), ConLoadHeightmap(), ConLoadScenario(), ConReload(), GenerateLandscape(), InitializeWindowsAndCaches(), SIGNChunkHandler::Load(), LoadTownData(), NetworkRestartMap(), SaveLoadWindow::OnClick(), SaveLoadWindow::OnTimeout(), openttd_main(), and ClientNetworkGameSocketHandler::ReceiveServerMapDone().
|
extern |
how to compress savegames
Definition at line 83 of file saveload.cpp.
Referenced by SaveFileToDisk().