Merge tag '12.0-beta1' into jgrpp-beta
# Conflicts: # CMakeLists.txt # bin/ai/CMakeLists.txt # bin/game/CMakeLists.txt # src/build_vehicle_gui.cpp # src/console_cmds.cpp # src/core/overflowsafe_type.hpp # src/fios.cpp # src/lang/english.txt # src/lang/german.txt # src/lang/korean.txt # src/lang/polish.txt # src/network/core/game_info.cpp # src/network/core/game_info.h # src/network/core/tcp_game.cpp # src/network/core/tcp_game.h # src/network/network.cpp # src/network/network_client.cpp # src/network/network_client.h # src/network/network_coordinator.cpp # src/network/network_gui.cpp # src/network/network_server.cpp # src/network/network_server.h # src/newgrf_engine.cpp # src/openttd.cpp # src/rev.cpp.in # src/settings_type.h # src/train.h # src/train_cmd.cpp
This commit is contained in:
@@ -3640,30 +3640,19 @@ SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop,
|
||||
* @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.
|
||||
*/
|
||||
void DoAutoOrNetsave(int &counter, bool netsave)
|
||||
void DoAutoOrNetsave(FiosNumberedSaveName &counter, bool threaded)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
|
||||
if (_settings_client.gui.keep_all_autosave) {
|
||||
GenerateDefaultSaveName(buf, lastof(buf));
|
||||
if (!netsave) {
|
||||
strecat(buf, ".sav", lastof(buf));
|
||||
} else {
|
||||
strecat(buf, "-netsave.sav", lastof(buf));
|
||||
}
|
||||
strecat(buf, counter.Extension().c_str(), lastof(buf));
|
||||
} else {
|
||||
/* Generate a savegame name and number according to _settings_client.gui.max_num_autosaves. */
|
||||
if (!netsave) {
|
||||
seprintf(buf, lastof(buf), "autosave%d.sav", counter);
|
||||
} else {
|
||||
seprintf(buf, lastof(buf), "netsave%d.sav", counter);
|
||||
}
|
||||
|
||||
if (++counter >= _settings_client.gui.max_num_autosaves) counter = 0;
|
||||
strecpy(buf, counter.Filename().c_str(), lastof(buf));
|
||||
}
|
||||
|
||||
DEBUG(sl, 2, "Autosaving to '%s'", buf);
|
||||
if (SaveOrLoad(buf, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, !netsave, SMF_ZSTD_OK) != SL_OK) {
|
||||
if (SaveOrLoad(buf, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, threaded, SMF_ZSTD_OK) != SL_OK) {
|
||||
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user