Merge branch 'master' into jgrpp

# Conflicts:
#	regression/regression/result.txt
#	src/aircraft_cmd.cpp
#	src/airport_gui.cpp
#	src/articulated_vehicles.cpp
#	src/console_cmds.cpp
#	src/date_gui.cpp
#	src/engine.cpp
#	src/genworld_gui.cpp
#	src/gfx_layout_fallback.cpp
#	src/group_gui.cpp
#	src/hotkeys.cpp
#	src/network/core/tcp_connect.cpp
#	src/network/core/tcp_listen.h
#	src/newgrf.cpp
#	src/newgrf.h
#	src/newgrf_engine.cpp
#	src/newgrf_gui.cpp
#	src/newgrf_station.cpp
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/os/macosx/osx_main.cpp
#	src/pathfinder/yapf/yapf_node_rail.hpp
#	src/rail_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/cargopacket_sl.cpp
#	src/saveload/linkgraph_sl.cpp
#	src/saveload/station_sl.cpp
#	src/script/api/script_industrytype.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_table.cpp
#	src/settingsgen/settingsgen.cpp
#	src/station.cpp
#	src/station_cmd.cpp
#	src/strings.cpp
#	src/timer/timer_game_calendar.cpp
#	src/timer/timer_game_calendar.h
#	src/timer/timer_manager.h
#	src/timer/timer_window.cpp
#	src/timetable_cmd.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/town_gui.cpp
#	src/train_gui.cpp
#	src/vehicle_cmd.h
#	src/vehicle_gui.cpp
#	src/viewport.cpp
#	src/widgets/dropdown.cpp
#	src/window_func.h
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-11-25 13:29:58 +00:00
175 changed files with 1086 additions and 1177 deletions

View File

@@ -201,7 +201,7 @@ struct GameOptionsWindow : Window {
if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) this->GetWidget<NWidgetStacked>(WID_GO_SURVEY_SEL)->SetDisplayedPlane(SZSP_NONE);
}
void Close() override
void Close([[maybe_unused]] int data = 0) override
{
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
CloseWindowByClass(WC_TEXTFILE);
@@ -228,18 +228,18 @@ struct GameOptionsWindow : Window {
int i = &currency - _currency_specs;
if (i == CURRENCY_CUSTOM) continue;
if (currency.code.empty()) {
list.emplace_back(new DropDownListStringItem(currency.name, i, HasBit(disabled, i)));
list.push_back(std::make_unique<DropDownListStringItem>(currency.name, i, HasBit(disabled, i)));
} else {
SetDParam(0, currency.name);
SetDParamStr(1, currency.code);
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CODE, i, HasBit(disabled, i)));
list.push_back(std::make_unique<DropDownListStringItem>(STR_GAME_OPTIONS_CURRENCY_CODE, i, HasBit(disabled, i)));
}
}
std::sort(list.begin(), list.end(), DropDownListStringItem::NatSortFunc);
/* Append custom currency at the end */
list.emplace_back(new DropDownListItem(-1, false)); // separator line
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM)));
list.push_back(std::make_unique<DropDownListItem>(-1, false)); // separator line
list.push_back(std::make_unique<DropDownListStringItem>(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM)));
break;
}
@@ -256,7 +256,7 @@ struct GameOptionsWindow : Window {
const StringID *items = _autosave_dropdown;
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
list.emplace_back(new DropDownListStringItem(*items, i, false));
list.push_back(std::make_unique<DropDownListStringItem>(*items, i, false));
}
break;
}
@@ -278,7 +278,7 @@ struct GameOptionsWindow : Window {
SetDParamStr(0, _languages[i].name);
}
SetDParam(1, (LANGUAGE_TOTAL_STRINGS - _languages[i].missing) * 100 / LANGUAGE_TOTAL_STRINGS);
list.emplace_back(new DropDownListStringItem(hide_percentage ? STR_JUST_RAW_STRING : STR_GAME_OPTIONS_LANGUAGE_PERCENTAGE, i, false));
list.push_back(std::make_unique<DropDownListStringItem>(hide_percentage ? STR_JUST_RAW_STRING : STR_GAME_OPTIONS_LANGUAGE_PERCENTAGE, i, false));
}
std::sort(list.begin(), list.end(), DropDownListStringItem::NatSortFunc);
break;
@@ -291,7 +291,7 @@ struct GameOptionsWindow : Window {
for (uint i = 0; i < _resolutions.size(); i++) {
SetDParam(0, _resolutions[i].width);
SetDParam(1, _resolutions[i].height);
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_RESOLUTION_ITEM, i, false));
list.push_back(std::make_unique<DropDownListStringItem>(STR_GAME_OPTIONS_RESOLUTION_ITEM, i, false));
}
break;
@@ -300,7 +300,7 @@ struct GameOptionsWindow : Window {
auto i = std::distance(_refresh_rates.begin(), it);
if (*it == _settings_client.gui.refresh_rate) *selected_index = i;
SetDParam(0, *it);
list.emplace_back(new DropDownListStringItem(STR_GAME_OPTIONS_REFRESH_RATE_ITEM, i, false));
list.push_back(std::make_unique<DropDownListStringItem>(STR_GAME_OPTIONS_REFRESH_RATE_ITEM, i, false));
}
break;
@@ -2709,15 +2709,15 @@ struct GameSettingsWindow : Window {
* we don't want to allow comparing with new game's settings. */
bool disabled = mode == RM_CHANGED_AGAINST_NEW && settings_ptr == &_settings_newgame;
list.emplace_back(new DropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled));
list.push_back(std::make_unique<DropDownListStringItem>(_game_settings_restrict_dropdown[mode], mode, disabled));
}
break;
case WID_GS_TYPE_DROPDOWN:
list.emplace_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false));
list.emplace_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false));
list.emplace_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false));
list.emplace_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false));
list.push_back(std::make_unique<DropDownListStringItem>(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false));
list.push_back(std::make_unique<DropDownListStringItem>(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false));
list.push_back(std::make_unique<DropDownListStringItem>(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false));
list.push_back(std::make_unique<DropDownListStringItem>(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false));
break;
}
return list;
@@ -2913,11 +2913,11 @@ struct GameSettingsWindow : Window {
}
}
assert_msg(val >= sd->min && val <= (int)sd->max, "min: %d, max: %d, val: %d", sd->min, sd->max, val);
list.emplace_back(new DropDownListStringItem(sd->str_val + val - sd->min, val, false));
list.push_back(std::make_unique<DropDownListStringItem>(sd->str_val + val - sd->min, val, false));
}
} else if ((sd->flags & SF_ENUM)) {
for (const SettingDescEnumEntry *enumlist = sd->enumlist; enumlist != nullptr && enumlist->str != STR_NULL; enumlist++) {
list.emplace_back(new DropDownListStringItem(enumlist->str, enumlist->val, false));
list.push_back(std::make_unique<DropDownListStringItem>(enumlist->str, enumlist->val, false));
}
}