Add text to warning dialog when overwriting a non-extended version save
This commit is contained in:
@@ -51,6 +51,8 @@ struct LoadCheckData {
|
|||||||
std::string debug_log_data;
|
std::string debug_log_data;
|
||||||
std::string debug_config_data;
|
std::string debug_config_data;
|
||||||
|
|
||||||
|
bool sl_is_ext_version = false;
|
||||||
|
|
||||||
LoadCheckData() : error_data(nullptr), grfconfig(nullptr),
|
LoadCheckData() : error_data(nullptr), grfconfig(nullptr),
|
||||||
grf_compatibility(GLC_NOT_FOUND), gamelog_action(nullptr), gamelog_actions(0)
|
grf_compatibility(GLC_NOT_FOUND), gamelog_action(nullptr), gamelog_actions(0)
|
||||||
{
|
{
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "core/geometry_func.hpp"
|
#include "core/geometry_func.hpp"
|
||||||
#include "gamelog.h"
|
#include "gamelog.h"
|
||||||
#include "stringfilter_type.h"
|
#include "stringfilter_type.h"
|
||||||
|
#include "gamelog.h"
|
||||||
|
|
||||||
#include "widgets/fios_widget.h"
|
#include "widgets/fios_widget.h"
|
||||||
|
|
||||||
@@ -68,6 +69,8 @@ void LoadCheckData::Clear()
|
|||||||
|
|
||||||
this->debug_log_data.clear();
|
this->debug_log_data.clear();
|
||||||
this->debug_config_data.clear();
|
this->debug_config_data.clear();
|
||||||
|
|
||||||
|
this->sl_is_ext_version = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Load game/scenario with optional content download */
|
/** Load game/scenario with optional content download */
|
||||||
@@ -814,7 +817,21 @@ public:
|
|||||||
/* Show a caption box asking whether the user is sure to overwrite the save */
|
/* Show a caption box asking whether the user is sure to overwrite the save */
|
||||||
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_ID, STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_ID, this, SaveLoadWindow::SaveGameConfirmationCallback);
|
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_ID, STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_ID, this, SaveLoadWindow::SaveGameConfirmationCallback);
|
||||||
} else if (_settings_client.gui.savegame_overwrite_confirm >= (known_id ? 3 : 2) && file_exists) {
|
} else if (_settings_client.gui.savegame_overwrite_confirm >= (known_id ? 3 : 2) && file_exists) {
|
||||||
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE, STR_SAVELOAD_OVERWRITE_WARNING, this, SaveLoadWindow::SaveGameConfirmationCallback);
|
if (!_load_check_data.sl_is_ext_version) {
|
||||||
|
const char *version = GamelogGetLastRevision(_load_check_data.gamelog_action, _load_check_data.gamelog_actions);
|
||||||
|
|
||||||
|
SetDParam(0, STR_SAVELOAD_OVERWRITE_TITLE);
|
||||||
|
std::string caption = GetString(STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_VERSION_SUFFIX);
|
||||||
|
|
||||||
|
SetDParam(0, STR_SAVELOAD_OVERWRITE_WARNING);
|
||||||
|
SetDParam(1, (version != nullptr) ? STR_SAVELOAD_OVERWRITE_WARNING_VERSION_NAME : STR_EMPTY);
|
||||||
|
SetDParamStr(2, version);
|
||||||
|
std::string message = GetString(STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_VERSION_SUFFIX);
|
||||||
|
|
||||||
|
ShowQuery(std::move(caption), std::move(message), this, SaveLoadWindow::SaveGameConfirmationCallback);
|
||||||
|
} else {
|
||||||
|
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE, STR_SAVELOAD_OVERWRITE_WARNING, this, SaveLoadWindow::SaveGameConfirmationCallback);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_switch_mode = SM_SAVE_GAME;
|
_switch_mode = SM_SAVE_GAME;
|
||||||
}
|
}
|
||||||
|
@@ -809,3 +809,22 @@ void GamelogInfo(LoggedAction *gamelog_action, uint gamelog_actions, uint32 *las
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *GamelogGetLastRevision(const LoggedAction *gamelog_action, uint gamelog_actions)
|
||||||
|
{
|
||||||
|
for (uint i = gamelog_actions; i > 0; i--) {
|
||||||
|
const LoggedAction &la = gamelog_action[i - 1];
|
||||||
|
const LoggedChange *lcend = &(la.change[la.changes]);
|
||||||
|
for (const LoggedChange *lc = la.change; lc != lcend; lc++) {
|
||||||
|
switch (lc->ct) {
|
||||||
|
case GLCT_REVISION:
|
||||||
|
return lc->revision.text;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@@ -62,5 +62,6 @@ void GamelogTestMode();
|
|||||||
bool GamelogGRFBugReverse(uint32 grfid, uint16 internal_id);
|
bool GamelogGRFBugReverse(uint32 grfid, uint16 internal_id);
|
||||||
|
|
||||||
void GamelogInfo(struct LoggedAction *gamelog_action, uint gamelog_actions, uint32 *last_ottd_rev, byte *ever_modified, bool *removed_newgrfs);
|
void GamelogInfo(struct LoggedAction *gamelog_action, uint gamelog_actions, uint32 *last_ottd_rev, byte *ever_modified, bool *removed_newgrfs);
|
||||||
|
const char *GamelogGetLastRevision(const struct LoggedAction *gamelog_action, uint gamelog_actions);
|
||||||
|
|
||||||
#endif /* GAMELOG_H */
|
#endif /* GAMELOG_H */
|
||||||
|
@@ -1198,7 +1198,10 @@ STR_LAI_BRIDGE_DESCRIPTION_RAILROAD_SIGNAL :Railway bridge
|
|||||||
STR_SAVELOAD_UNKNOWN_ID :{YELLOW}This file may be from a different game.
|
STR_SAVELOAD_UNKNOWN_ID :{YELLOW}This file may be from a different game.
|
||||||
STR_SAVELOAD_DIFFERENT_ID :{YELLOW}This file is from a different game.
|
STR_SAVELOAD_DIFFERENT_ID :{YELLOW}This file is from a different game.
|
||||||
STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_ID :{WHITE}Overwrite File (Different Game)
|
STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_ID :{WHITE}Overwrite File (Different Game)
|
||||||
|
STR_SAVELOAD_OVERWRITE_TITLE_DIFFERENT_VERSION_SUFFIX :{STRING} (Different Version)
|
||||||
STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_ID :{YELLOW}Are you sure you want to overwrite the existing file?{}{}The file is from a different game.
|
STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_ID :{YELLOW}Are you sure you want to overwrite the existing file?{}{}The file is from a different game.
|
||||||
|
STR_SAVELOAD_OVERWRITE_WARNING_DIFFERENT_VERSION_SUFFIX :{STRING}{}{}The file is from a different version{STRING1}.{}If overwritten the file will no longer be readable by the original version.
|
||||||
|
STR_SAVELOAD_OVERWRITE_WARNING_VERSION_NAME : ({RAW_STRING})
|
||||||
|
|
||||||
STR_MAPGEN_SNOW_LINE_HEIGHT :{BLACK}Snow line height:
|
STR_MAPGEN_SNOW_LINE_HEIGHT :{BLACK}Snow line height:
|
||||||
STR_MAPGEN_SNOW_LINE_UP :{BLACK}Move the snow line height one up
|
STR_MAPGEN_SNOW_LINE_UP :{BLACK}Move the snow line height one up
|
||||||
|
@@ -3587,6 +3587,7 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
|||||||
if (load_check) {
|
if (load_check) {
|
||||||
/* The only part from AfterLoadGame() we need */
|
/* The only part from AfterLoadGame() we need */
|
||||||
if (_load_check_data.want_grf_compatibility) _load_check_data.grf_compatibility = IsGoodGRFConfigList(_load_check_data.grfconfig);
|
if (_load_check_data.want_grf_compatibility) _load_check_data.grf_compatibility = IsGoodGRFConfigList(_load_check_data.grfconfig);
|
||||||
|
_load_check_data.sl_is_ext_version = _sl_is_ext_version;
|
||||||
} else {
|
} else {
|
||||||
GamelogStartAction(GLAT_LOAD);
|
GamelogStartAction(GLAT_LOAD);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user