Add GUI setting to control savegame overwrite confirmation dialog
Adjust game ID indications in save window UI
This commit is contained in:
@@ -478,11 +478,14 @@ public:
|
||||
y, r.bottom - WD_FRAMERECT_BOTTOM, _load_check_data.error, TC_RED);
|
||||
} else {
|
||||
/* Warning if save unique id differ when saving */
|
||||
if (this->fop == SLO_SAVE &&
|
||||
_load_check_data.settings.game_creation.generation_unique_id != 0 && /* Don't warn if the save has no id (old save) */
|
||||
_load_check_data.settings.game_creation.generation_unique_id != _settings_game.game_creation.generation_unique_id) {
|
||||
y = DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT,
|
||||
y, r.bottom - WD_FRAMERECT_BOTTOM, STR_SAVELOAD_DIFFERENT_ID);
|
||||
if (this->fop == SLO_SAVE) {
|
||||
if (_load_check_data.settings.game_creation.generation_unique_id == 0) {
|
||||
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y_max, STR_SAVELOAD_UNKNOWN_ID);
|
||||
y_max -= FONT_HEIGHT_NORMAL;
|
||||
} else if (_load_check_data.settings.game_creation.generation_unique_id != _settings_game.game_creation.generation_unique_id) {
|
||||
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y_max, STR_SAVELOAD_DIFFERENT_ID);
|
||||
y_max -= FONT_HEIGHT_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mapsize */
|
||||
@@ -754,19 +757,20 @@ public:
|
||||
} else if (this->IsWidgetLowered(WID_SL_SAVE_GAME)) { // Save button clicked
|
||||
if (this->abstract_filetype == FT_SAVEGAME || this->abstract_filetype == FT_SCENARIO) {
|
||||
FiosMakeSavegameName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name));
|
||||
if (_load_check_data.settings.game_creation.generation_unique_id != 0 && /* Don't warn if the save has no id (old save) */
|
||||
_load_check_data.settings.game_creation.generation_unique_id != _settings_game.game_creation.generation_unique_id) {
|
||||
const bool known_id = _load_check_data.settings.game_creation.generation_unique_id != 0;
|
||||
const bool different_id = known_id && _load_check_data.settings.game_creation.generation_unique_id != _settings_game.game_creation.generation_unique_id;
|
||||
if (_settings_client.gui.savegame_overwrite_confirm >= 1 && different_id) {
|
||||
/* The save has a different id to the current game */
|
||||
/* 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);
|
||||
} else if (FioCheckFileExists(_file_to_saveload.name, Subdirectory::SAVE_DIR)) {
|
||||
} else if (_settings_client.gui.savegame_overwrite_confirm >= (known_id ? 3 : 2) && FioCheckFileExists(_file_to_saveload.name, Subdirectory::SAVE_DIR)) {
|
||||
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE, STR_SAVELOAD_OVERWRITE_WARNING, this, SaveLoadWindow::SaveGameConfirmationCallback);
|
||||
} else {
|
||||
_switch_mode = SM_SAVE_GAME;
|
||||
}
|
||||
} else {
|
||||
FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name));
|
||||
if (FioCheckFileExists(_file_to_saveload.name, Subdirectory::SAVE_DIR)) {
|
||||
if (_settings_client.gui.savegame_overwrite_confirm >= 1 && FioCheckFileExists(_file_to_saveload.name, Subdirectory::SAVE_DIR)) {
|
||||
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE, STR_SAVELOAD_OVERWRITE_WARNING, this, SaveLoadWindow::SaveHeightmapConfirmationCallback);
|
||||
} else {
|
||||
_switch_mode = SM_SAVE_HEIGHTMAP;
|
||||
|
@@ -1478,6 +1478,13 @@ STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :long (31st Dec
|
||||
STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT :short (31-12-2008)
|
||||
STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_ISO :ISO (2008-12-31)
|
||||
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM :Warn before overwriting an existing savegame file: {STRING}
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_HELPTEXT :If saving a savegame or heightmap would overwrite an existing save file, display a confirmation dialog.
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_DISABLED :No
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_DIFFERENT :Only if different
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_DIFFERENT_UNKNOWN :Only if different or unknown
|
||||
STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_ENABLED :Yes
|
||||
|
||||
STR_CONFIG_SETTING_PAUSE_ON_NEW_GAME :Automatically pause when starting a new game: {STRING2}
|
||||
STR_CONFIG_SETTING_PAUSE_ON_NEW_GAME_HELPTEXT :When enabled, the game will automatically pause when starting a new game, allowing for closer study of the map
|
||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL :When paused allow: {STRING2}
|
||||
@@ -3300,7 +3307,8 @@ STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF:
|
||||
STR_SAVELOAD_FILTER_TITLE :{BLACK}Filter string:
|
||||
STR_SAVELOAD_OVERWRITE_TITLE :{WHITE}Overwrite File
|
||||
STR_SAVELOAD_OVERWRITE_WARNING :{YELLOW}Are you sure you want to overwrite the existing file?
|
||||
STR_SAVELOAD_DIFFERENT_ID :{YELLOW}This file is 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_OVERWRITE_TITLE_DIFFERENT_ID :{WHITE}Overwrite File (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.
|
||||
|
||||
|
@@ -1605,6 +1605,7 @@ static SettingsContainer &GetSettingsTree()
|
||||
|
||||
interface->Add(new SettingEntry("gui.autosave"));
|
||||
interface->Add(new SettingEntry("gui.autosave_on_network_disconnect"));
|
||||
interface->Add(new SettingEntry("gui.savegame_overwrite_confirm"));
|
||||
interface->Add(new SettingEntry("gui.toolbar_pos"));
|
||||
interface->Add(new SettingEntry("gui.statusbar_pos"));
|
||||
interface->Add(new SettingEntry("gui.prefer_teamchat"));
|
||||
|
@@ -117,6 +117,7 @@ struct GUISettings {
|
||||
bool autosave_on_network_disconnect; ///< save an autosave when you get disconnected from a network game with an error?
|
||||
uint8 date_format_in_default_names; ///< should the default savegame/screenshot name use long dates (31th Dec 2008), short dates (31-12-2008) or ISO dates (2008-12-31)
|
||||
byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
|
||||
uint8 savegame_overwrite_confirm; ///< Mode for when to warn about overwriting an existing savegame
|
||||
bool population_in_label; ///< show the population of a town in his label?
|
||||
uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking?
|
||||
uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel?
|
||||
|
@@ -21,6 +21,7 @@ static const char *_climates = "temperate|arctic|tropic|toyland";
|
||||
static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly";
|
||||
static const char *_roadsides = "left|right";
|
||||
static const char *_savegame_date = "long|short|iso";
|
||||
static const char *_savegame_overwrite_confirm = "no|different|not same|yes";
|
||||
#ifdef ENABLE_NETWORK
|
||||
static const char *_server_langs = "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN";
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -4023,6 +4023,19 @@ def = 16
|
||||
min = 0
|
||||
max = 255
|
||||
|
||||
[SDTC_OMANY]
|
||||
var = gui.savegame_overwrite_confirm
|
||||
type = SLE_UINT8
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
str = STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM
|
||||
strhelp = STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SAVEGAME_OVERWRITE_CONFIRM_DISABLED
|
||||
guiflags = SGF_MULTISTRING
|
||||
full = _savegame_overwrite_confirm
|
||||
def = 3
|
||||
min = 0
|
||||
max = 3
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.auto_euro
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
|
Reference in New Issue
Block a user