MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DoAutoOrNetsave

Function DoAutoOrNetsave

src/saveload/saveload.cpp:3349–3363  ·  view source on GitHub ↗

* Create an autosave or netsave. * @param counter A reference to the counter variable to be used for rotating the file name. * @param netsave Indicates if this is a regular autosave or a netsave. */

Source from the content-addressed store, hash-verified

3347 * @param netsave Indicates if this is a regular autosave or a netsave.
3348 */
3349void DoAutoOrNetsave(FiosNumberedSaveName &counter)
3350{
3351 std::string filename;
3352
3353 if (_settings_client.gui.keep_all_autosave) {
3354 filename = GenerateDefaultSaveName() + counter.Extension();
3355 } else {
3356 filename = counter.Filename();
3357 }
3358
3359 Debug(sl, 2, "Autosaving to '{}'", filename);
3360 if (SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR) != SL_OK) {
3361 ShowErrorMessage(GetEncodedString(STR_ERROR_AUTOSAVE_FAILED), {}, WL_ERROR);
3362 }
3363}
3364
3365
3366/** Do a save when exiting the game (_settings_client.gui.autosave_on_exit) */

Callers 2

openttd.cppFile · 0.85

Calls 6

GenerateDefaultSaveNameFunction · 0.85
SaveOrLoadFunction · 0.85
ShowErrorMessageFunction · 0.85
ExtensionMethod · 0.80
FilenameMethod · 0.80
GetEncodedStringFunction · 0.50

Tested by

no test coverage detected