Merge branch 'master' into jgrpp

# Conflicts:
#	src/fios_gui.cpp
#	src/lang/english.txt
#	src/lang/german.txt
This commit is contained in:
Jonathan G Rennison
2019-02-02 01:27:56 +00:00
103 changed files with 957 additions and 491 deletions

View File

@@ -283,7 +283,17 @@ private:
QueryString filter_editbox; ///< Filter editbox;
SmallVector<bool, 32> fios_items_shown; ///< Map of the filtered out fios items
friend void SaveGameConfirmationCallback(Window *w, bool confirmed);
static void SaveGameConfirmationCallback(Window *w, bool confirmed)
{
/* File name has already been written to _file_to_saveload */
if (confirmed) _switch_mode = SM_SAVE_GAME;
}
static void SaveHeightmapConfirmationCallback(Window *w, bool confirmed)
{
/* File name has already been written to _file_to_saveload */
if (confirmed) _switch_mode = SM_SAVE_HEIGHTMAP;
}
public:
@@ -743,18 +753,24 @@ 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) {
/* 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_SAVEGAME_UNMATCHING_ID_CAPTION, STR_SAVEGAME_UNMATCHING_ID_CONFIRMATION_TEXT, this, SaveGameConfirmationCallback);
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)) {
ShowQuery(STR_SAVELOAD_OVERWRITE_TITLE, STR_SAVELOAD_OVERWRITE_WARNING, this, SaveLoadWindow::SaveGameConfirmationCallback);
} else {
/* We can safely overwrite the save */
SaveGameConfirmationCallback(this, true);
_switch_mode = SM_SAVE_GAME;
}
} else {
_switch_mode = SM_SAVE_HEIGHTMAP;
FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name));
if (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;
}
}
/* In the editor set up the vehicle engines correctly (date might have changed) */
@@ -883,19 +899,6 @@ static WindowDesc _save_dialog_desc(
_nested_save_dialog_widgets, lengthof(_nested_save_dialog_widgets)
);
/**
* Callback function for the savegame 'are you sure you want to overwrite save' window
* @param w Window which is calling this callback
* @param confirmed boolean value, true when yes was clicked, false otherwise
*/
void SaveGameConfirmationCallback(Window *w, bool confirmed)
{
if (confirmed) {
_switch_mode = SM_SAVE_GAME;
FiosMakeSavegameName(_file_to_saveload.name, dynamic_cast<SaveLoadWindow*>(w)->filename_editbox.text.buf, lastof(_file_to_saveload.name));
}
}
/**
* Launch save/load dialog in the given mode.
* @param abstract_filetype Kind of file to handle.