Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/release-windows.yml # src/company_base.h # src/company_cmd.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/economy.cpp # src/economy_cmd.h # src/fios.h # src/goal.cpp # src/group_gui.cpp # src/network/core/config.h # src/network/network_admin.cpp # src/newgrf_config.cpp # src/os/windows/win32.cpp # src/saveload/afterload.cpp # src/saveload/company_sl.cpp # src/saveload/saveload.cpp # src/saveload/saveload_error.hpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/stdafx.h # src/story.cpp # src/story_base.h # src/string.cpp # src/table/settings/economy_settings.ini # src/tests/CMakeLists.txt # src/tests/math_func.cpp
This commit is contained in:
@@ -49,8 +49,7 @@ void LoadCheckData::Clear()
|
||||
{
|
||||
this->checkable = false;
|
||||
this->error = INVALID_STRING_ID;
|
||||
free(this->error_data);
|
||||
this->error_data = nullptr;
|
||||
this->error_msg.clear();
|
||||
|
||||
this->map_size_x = this->map_size_y = 256; // Default for old savegames which do not store mapsize.
|
||||
this->current_date = 0;
|
||||
@@ -385,24 +384,22 @@ public:
|
||||
|
||||
/* Select the initial directory. */
|
||||
o_dir.type = FIOS_TYPE_DIRECT;
|
||||
std::string dir;
|
||||
switch (this->abstract_filetype) {
|
||||
case FT_SAVEGAME:
|
||||
dir = FioFindDirectory(SAVE_DIR);
|
||||
o_dir.name = FioFindDirectory(SAVE_DIR);
|
||||
break;
|
||||
|
||||
case FT_SCENARIO:
|
||||
dir = FioFindDirectory(SCENARIO_DIR);
|
||||
o_dir.name = FioFindDirectory(SCENARIO_DIR);
|
||||
break;
|
||||
|
||||
case FT_HEIGHTMAP:
|
||||
dir = FioFindDirectory(HEIGHTMAP_DIR);
|
||||
o_dir.name = FioFindDirectory(HEIGHTMAP_DIR);
|
||||
break;
|
||||
|
||||
default:
|
||||
dir = _personal_dir;
|
||||
o_dir.name = _personal_dir;
|
||||
}
|
||||
strecpy(o_dir.name, dir.c_str(), lastof(o_dir.name));
|
||||
|
||||
switch (this->fop) {
|
||||
case SLO_SAVE:
|
||||
@@ -508,7 +505,7 @@ public:
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
} else if (_load_check_data.error != INVALID_STRING_ID) {
|
||||
/* Incompatible / broken savegame */
|
||||
SetDParamStr(0, _load_check_data.error_data);
|
||||
SetDParamStr(0, _load_check_data.error_msg);
|
||||
tr.top = DrawStringMultiLine(tr, _load_check_data.error, TC_RED);
|
||||
} else {
|
||||
/* Warning if save unique id differ when saving */
|
||||
@@ -651,10 +648,7 @@ public:
|
||||
case WID_SL_LOAD_BUTTON: {
|
||||
if (this->selected == nullptr || _load_check_data.HasErrors()) break;
|
||||
|
||||
const char *name = FiosBrowseTo(this->selected);
|
||||
_file_to_saveload.SetMode(this->selected->type);
|
||||
_file_to_saveload.SetName(name);
|
||||
_file_to_saveload.SetTitle(this->selected->title);
|
||||
_file_to_saveload.Set(*this->selected);
|
||||
|
||||
if (this->abstract_filetype == FT_HEIGHTMAP) {
|
||||
delete this;
|
||||
@@ -693,8 +687,7 @@ public:
|
||||
}
|
||||
const FiosItem *file = &this->fios_items[y];
|
||||
|
||||
const char *name = FiosBrowseTo(file);
|
||||
if (name == nullptr) {
|
||||
if (FiosBrowseTo(file)) {
|
||||
/* Changed directory, need refresh. */
|
||||
this->InvalidateData(SLIWD_RESCAN_FILES);
|
||||
break;
|
||||
@@ -707,14 +700,14 @@ public:
|
||||
|
||||
if (GetDetailedFileType(file->type) == DFT_GAME_FILE) {
|
||||
/* Other detailed file types cannot be checked before. */
|
||||
SaveOrLoad(name, SLO_CHECK, DFT_GAME_FILE, NO_DIRECTORY, false);
|
||||
SaveOrLoad(file->name, SLO_CHECK, DFT_GAME_FILE, NO_DIRECTORY, false);
|
||||
}
|
||||
|
||||
this->InvalidateData(SLIWD_SELECTION_CHANGES);
|
||||
}
|
||||
if (this->fop == SLO_SAVE) {
|
||||
/* Copy clicked name to editbox */
|
||||
this->filename_editbox.text.Assign(file->title);
|
||||
this->filename_editbox.text.Assign(file->title.c_str());
|
||||
this->SetWidgetDirty(WID_SL_SAVE_OSK_TITLE);
|
||||
}
|
||||
} else if (!_load_check_data.HasErrors()) {
|
||||
@@ -724,9 +717,7 @@ public:
|
||||
this->OnClick(pt, WID_SL_LOAD_BUTTON, 1);
|
||||
} else {
|
||||
assert(this->abstract_filetype == FT_HEIGHTMAP);
|
||||
_file_to_saveload.SetMode(file->type);
|
||||
_file_to_saveload.SetName(name);
|
||||
_file_to_saveload.SetTitle(file->title);
|
||||
_file_to_saveload.Set(*file);
|
||||
|
||||
delete this;
|
||||
ShowHeightmapLoad();
|
||||
@@ -920,7 +911,7 @@ public:
|
||||
items_shown_count++;
|
||||
} else {
|
||||
this->string_filter.ResetState();
|
||||
this->string_filter.AddLine(this->fios_items[i].title);
|
||||
this->string_filter.AddLine(this->fios_items[i].title.c_str());
|
||||
/* We set the vector to show this fios element as filtered depending on the result of the filter */
|
||||
this->fios_items_shown[i] = this->string_filter.GetState();
|
||||
if (this->fios_items_shown[i]) items_shown_count++;
|
||||
|
Reference in New Issue
Block a user