mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use std::string_view for ini_key
parent
d958d50985
commit
7805c1c189
|
@ -84,7 +84,7 @@ static constexpr NWidgetPart _nested_ai_config_widgets[] = {
|
|||
|
||||
/** Window definition for the configure AI window. */
|
||||
static WindowDesc _ai_config_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
{},
|
||||
_nested_ai_config_widgets
|
||||
|
|
|
@ -618,7 +618,7 @@ static constexpr NWidgetPart _nested_build_airport_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _build_airport_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_airport_widgets
|
||||
|
|
|
@ -42,7 +42,7 @@ static constexpr NWidgetPart _background_widgets[] = {
|
|||
* Window description for the background window to prevent smearing.
|
||||
*/
|
||||
static WindowDesc _background_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_BOOTSTRAP, WC_NONE,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_background_widgets
|
||||
|
@ -78,7 +78,7 @@ static constexpr NWidgetPart _nested_bootstrap_errmsg_widgets[] = {
|
|||
|
||||
/** Window description for the error window. */
|
||||
static WindowDesc _bootstrap_errmsg_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_BOOTSTRAP, WC_NONE,
|
||||
{WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose},
|
||||
_nested_bootstrap_errmsg_widgets
|
||||
|
@ -135,7 +135,7 @@ static constexpr NWidgetPart _nested_bootstrap_download_status_window_widgets[]
|
|||
|
||||
/** Window description for the download window */
|
||||
static WindowDesc _bootstrap_download_status_window_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
{WindowDefaultFlag::Modal, WindowDefaultFlag::NoClose},
|
||||
_nested_bootstrap_download_status_window_widgets
|
||||
|
@ -187,7 +187,7 @@ static constexpr NWidgetPart _bootstrap_query_widgets[] = {
|
|||
|
||||
/** The window description for the query. */
|
||||
static WindowDesc _bootstrap_query_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_CONFIRM_POPUP_QUERY, WC_NONE,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_bootstrap_query_widgets
|
||||
|
|
|
@ -1708,7 +1708,7 @@ public:
|
|||
|
||||
/** Company manager face selection window description */
|
||||
static WindowDesc _select_company_manager_face_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_COMPANY_MANAGER_FACE, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_select_company_manager_face_widgets
|
||||
|
@ -2616,7 +2616,7 @@ static constexpr NWidgetPart _nested_buy_company_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _buy_company_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUY_COMPANY, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_buy_company_widgets
|
||||
|
|
|
@ -137,7 +137,7 @@ static constexpr NWidgetPart _nested_console_window_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _console_window_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_CONSOLE, WC_NONE,
|
||||
{},
|
||||
_nested_console_window_widgets
|
||||
|
|
|
@ -196,7 +196,7 @@ static constexpr NWidgetPart _nested_set_date_widgets[] = {
|
|||
|
||||
/** Description of the date setting window. */
|
||||
static WindowDesc _set_date_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_SET_DATE, WC_NONE,
|
||||
{},
|
||||
_nested_set_date_widgets
|
||||
|
|
|
@ -507,7 +507,7 @@ static constexpr NWidgetPart _nested_build_dock_station_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _build_dock_station_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_dock_station_widgets
|
||||
|
@ -602,7 +602,7 @@ static constexpr NWidgetPart _nested_build_docks_depot_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _build_docks_depot_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_docks_depot_widgets
|
||||
|
|
|
@ -65,7 +65,7 @@ static constexpr NWidgetPart _nested_dropdown_menu_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _dropdown_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_DROPDOWN_MENU, WC_NONE,
|
||||
WindowDefaultFlag::NoFocus,
|
||||
_nested_dropdown_menu_widgets
|
||||
|
|
|
@ -141,7 +141,7 @@ struct EnginePreviewWindow : Window {
|
|||
};
|
||||
|
||||
static WindowDesc _engine_preview_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_ENGINE_PREVIEW, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_engine_preview_widgets
|
||||
|
|
|
@ -44,7 +44,7 @@ static constexpr NWidgetPart _nested_errmsg_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _errmsg_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_ERRMSG, WC_NONE,
|
||||
{},
|
||||
_nested_errmsg_widgets
|
||||
|
@ -64,7 +64,7 @@ static constexpr NWidgetPart _nested_errmsg_face_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _errmsg_face_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_ERRMSG, WC_NONE,
|
||||
{},
|
||||
_nested_errmsg_face_widgets
|
||||
|
|
|
@ -975,14 +975,14 @@ struct GenerateLandscapeWindow : public Window {
|
|||
};
|
||||
|
||||
static WindowDesc _generate_landscape_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
{},
|
||||
_nested_generate_landscape_widgets
|
||||
);
|
||||
|
||||
static WindowDesc _heightmap_load_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
{},
|
||||
_nested_heightmap_load_widgets
|
||||
|
@ -1282,7 +1282,7 @@ static constexpr NWidgetPart _nested_create_scenario_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _create_scenario_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GENERATE_LANDSCAPE, WC_NONE,
|
||||
{},
|
||||
_nested_create_scenario_widgets
|
||||
|
@ -1308,7 +1308,7 @@ static constexpr NWidgetPart _nested_generate_progress_widgets[] = {
|
|||
|
||||
|
||||
static WindowDesc _generate_progress_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_MODAL_PROGRESS, WC_NONE,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_generate_progress_widgets
|
||||
|
|
|
@ -440,25 +440,25 @@ static constexpr auto _nested_goal_question_widgets_error = NestedGoalWidgets
|
|||
|
||||
static WindowDesc _goal_question_list_desc[] = {
|
||||
{
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_question,
|
||||
},
|
||||
{
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_info,
|
||||
},
|
||||
{
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_warning,
|
||||
},
|
||||
{
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_goal_question_widgets_error,
|
||||
|
|
|
@ -202,7 +202,7 @@ static constexpr NWidgetPart _nested_helpwin_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _helpwin_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_HELPWIN, WC_NONE,
|
||||
{},
|
||||
_nested_helpwin_widgets
|
||||
|
|
|
@ -214,14 +214,14 @@ static constexpr NWidgetPart _nested_highscore_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _highscore_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_HIGHSCORE, WC_NONE,
|
||||
{},
|
||||
_nested_highscore_widgets
|
||||
);
|
||||
|
||||
static WindowDesc _endgame_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_ENDSCREEN, WC_NONE,
|
||||
{},
|
||||
_nested_highscore_widgets
|
||||
|
|
|
@ -443,7 +443,7 @@ static constexpr NWidgetPart _nested_select_game_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _select_game_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_SELECT_GAME, WC_NONE,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_select_game_widgets
|
||||
|
|
|
@ -522,7 +522,7 @@ struct MainWindow : Window
|
|||
};
|
||||
|
||||
static WindowDesc _main_window_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_MAIN_WINDOW, WC_NONE,
|
||||
WindowDefaultFlag::NoClose,
|
||||
_nested_main_window_widgets,
|
||||
|
|
|
@ -58,7 +58,7 @@ static constexpr NWidgetPart _nested_land_info_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _land_info_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_LAND_INFO, WC_NONE,
|
||||
{},
|
||||
_nested_land_info_widgets
|
||||
|
@ -336,7 +336,7 @@ static constexpr NWidgetPart _nested_about_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _about_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
{},
|
||||
_nested_about_widgets
|
||||
|
@ -591,7 +591,7 @@ static constexpr NWidgetPart _nested_tooltips_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _tool_tips_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0, // Coordinates and sizes are not used,
|
||||
WDP_MANUAL, {}, 0, 0, // Coordinates and sizes are not used,
|
||||
WC_TOOLTIPS, WC_NONE,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_tooltips_widgets
|
||||
|
@ -991,7 +991,7 @@ static constexpr NWidgetPart _nested_query_string_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _query_string_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_QUERY_STRING, WC_NONE,
|
||||
{},
|
||||
_nested_query_string_widgets
|
||||
|
@ -1130,7 +1130,7 @@ static constexpr NWidgetPart _nested_query_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _query_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_CONFIRM_POPUP_QUERY, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_query_widgets
|
||||
|
|
|
@ -661,7 +661,7 @@ static constexpr NWidgetPart _nested_music_track_selection_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _music_track_selection_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_MUSIC_TRACK_SELECTION, WC_NONE,
|
||||
{},
|
||||
_nested_music_track_selection_widgets
|
||||
|
|
|
@ -427,7 +427,7 @@ static constexpr NWidgetPart _nested_chat_window_widgets[] = {
|
|||
|
||||
/** The description of the chat window. */
|
||||
static WindowDesc _chat_window_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_SEND_NETWORK_MSG, WC_NONE,
|
||||
{},
|
||||
_nested_chat_window_widgets
|
||||
|
|
|
@ -99,7 +99,7 @@ static constexpr NWidgetPart _nested_network_content_download_status_window_widg
|
|||
|
||||
/** Window description for the download window */
|
||||
static WindowDesc _network_content_download_status_window_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_content_download_status_window_widgets
|
||||
|
|
|
@ -1203,7 +1203,7 @@ static constexpr NWidgetPart _nested_network_start_server_window_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _network_start_server_window_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_network_start_server_window_widgets
|
||||
|
@ -2159,7 +2159,7 @@ static constexpr NWidgetPart _nested_network_join_status_window_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _network_join_status_window_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_STATUS_WINDOW, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_join_status_window_widgets
|
||||
|
@ -2266,7 +2266,7 @@ static constexpr NWidgetPart _nested_network_ask_relay_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _network_ask_relay_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_ASK_RELAY, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_ask_relay_widgets
|
||||
|
@ -2364,7 +2364,7 @@ static constexpr NWidgetPart _nested_network_ask_survey_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _network_ask_survey_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_NETWORK_ASK_SURVEY, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_network_ask_survey_widgets
|
||||
|
|
|
@ -2152,7 +2152,7 @@ static constexpr NWidgetPart _nested_scan_progress_widgets[] = {
|
|||
|
||||
/** Description of the widgets and other settings of the window. */
|
||||
static WindowDesc _scan_progress_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_MODAL_PROGRESS, WC_NONE,
|
||||
{},
|
||||
_nested_scan_progress_widgets
|
||||
|
|
|
@ -127,7 +127,7 @@ static constexpr NWidgetPart _nested_normal_news_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _normal_news_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_normal_news_widgets
|
||||
|
@ -175,7 +175,7 @@ static constexpr NWidgetPart _nested_vehicle_news_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _vehicle_news_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_vehicle_news_widgets
|
||||
|
@ -220,7 +220,7 @@ static constexpr NWidgetPart _nested_company_news_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _company_news_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_company_news_widgets
|
||||
|
@ -254,7 +254,7 @@ static constexpr NWidgetPart _nested_thin_news_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _thin_news_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_thin_news_widgets
|
||||
|
@ -290,7 +290,7 @@ static constexpr NWidgetPart _nested_small_news_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _small_news_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_NEWS_WINDOW, WC_NONE,
|
||||
{},
|
||||
_nested_small_news_widgets
|
||||
|
|
|
@ -339,7 +339,7 @@ static constexpr NWidgetPart _nested_osk_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _osk_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_OSK, WC_NONE,
|
||||
{},
|
||||
_nested_osk_widgets
|
||||
|
|
|
@ -1697,7 +1697,7 @@ static constexpr NWidgetPart _nested_signal_builder_widgets[] = {
|
|||
|
||||
/** Signal selection window description */
|
||||
static WindowDesc _signal_builder_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_signal_builder_widgets
|
||||
|
@ -1778,7 +1778,7 @@ static constexpr NWidgetPart _nested_build_depot_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _build_depot_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_depot_widgets
|
||||
|
|
|
@ -1167,7 +1167,7 @@ static constexpr NWidgetPart _nested_build_road_depot_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _build_road_depot_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WDP_AUTO, {}, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_build_road_depot_widgets
|
||||
|
|
|
@ -2149,7 +2149,7 @@ static constexpr NWidgetPart _nested_cust_currency_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _cust_currency_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_CUSTOM_CURRENCY, WC_NONE,
|
||||
{},
|
||||
_nested_cust_currency_widgets
|
||||
|
|
|
@ -544,7 +544,7 @@ static constexpr NWidgetPart _nested_query_sign_edit_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _query_sign_edit_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_QUERY_STRING, WC_NONE,
|
||||
WindowDefaultFlag::Construction,
|
||||
_nested_query_sign_edit_widgets
|
||||
|
|
|
@ -219,7 +219,7 @@ static constexpr NWidgetPart _nested_main_status_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _main_status_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_STATUS_BAR, WC_NONE,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_main_status_widgets
|
||||
|
|
|
@ -32,11 +32,11 @@ private:
|
|||
|
||||
TEST_CASE("WindowDesc - ini_key uniqueness")
|
||||
{
|
||||
std::set<std::string> seen;
|
||||
std::set<std::string_view> seen;
|
||||
|
||||
for (const WindowDesc *window_desc : *_window_descs) {
|
||||
|
||||
if (window_desc->ini_key == nullptr) continue;
|
||||
if (window_desc->ini_key.empty()) continue;
|
||||
|
||||
CAPTURE(window_desc->ini_key);
|
||||
CHECK((seen.find(window_desc->ini_key) == std::end(seen)));
|
||||
|
@ -49,7 +49,7 @@ TEST_CASE("WindowDesc - ini_key validity")
|
|||
{
|
||||
const WindowDesc *window_desc = GENERATE(from_range(std::begin(*_window_descs), std::end(*_window_descs)));
|
||||
|
||||
bool has_inikey = window_desc->ini_key != nullptr;
|
||||
bool has_inikey = !window_desc->ini_key.empty();
|
||||
bool has_widget = std::any_of(std::begin(window_desc->nwid_parts), std::end(window_desc->nwid_parts), [](const NWidgetPart &part) { return part.type == WWT_DEFSIZEBOX || part.type == WWT_STICKYBOX; });
|
||||
|
||||
INFO(fmt::format("{}:{}", window_desc->source_location.file_name(), window_desc->source_location.line()));
|
||||
|
|
|
@ -2242,7 +2242,7 @@ static constexpr NWidgetPart _nested_toolbar_normal_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _toolb_normal_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_MAIN_TOOLBAR, WC_NONE,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_toolbar_normal_widgets,
|
||||
|
@ -2585,7 +2585,7 @@ static constexpr NWidgetPart _nested_toolb_scen_widgets[] = {
|
|||
};
|
||||
|
||||
static WindowDesc _toolb_scen_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_MAIN_TOOLBAR, WC_NONE,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_toolb_scen_widgets,
|
||||
|
|
|
@ -104,7 +104,7 @@ std::vector<WindowDesc*> *_window_descs = nullptr;
|
|||
std::string _windows_file;
|
||||
|
||||
/** Window description constructor. */
|
||||
WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad,
|
||||
WindowDesc::WindowDesc(WindowPosition def_pos, std::string_view ini_key, int16_t def_width_trad, int16_t def_height_trad,
|
||||
WindowClass window_class, WindowClass parent_class, WindowDefaultFlags flags,
|
||||
const std::span<const NWidgetPart> nwid_parts, HotkeyList *hotkeys,
|
||||
const std::source_location location) :
|
||||
|
@ -156,7 +156,7 @@ void WindowDesc::LoadFromConfig()
|
|||
IniFile ini;
|
||||
ini.LoadFromDisk(_windows_file, NO_DIRECTORY);
|
||||
for (WindowDesc *wd : *_window_descs) {
|
||||
if (wd->ini_key == nullptr) continue;
|
||||
if (wd->ini_key.empty()) continue;
|
||||
IniLoadWindowSettings(ini, wd->ini_key, wd);
|
||||
}
|
||||
}
|
||||
|
@ -166,8 +166,7 @@ void WindowDesc::LoadFromConfig()
|
|||
*/
|
||||
static bool DescSorter(WindowDesc * const &a, WindowDesc * const &b)
|
||||
{
|
||||
if (a->ini_key != nullptr && b->ini_key != nullptr) return strcmp(a->ini_key, b->ini_key) < 0;
|
||||
return a->ini_key != nullptr;
|
||||
return a->ini_key < b->ini_key;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,7 +180,7 @@ void WindowDesc::SaveToConfig()
|
|||
IniFile ini;
|
||||
ini.LoadFromDisk(_windows_file, NO_DIRECTORY);
|
||||
for (WindowDesc *wd : *_window_descs) {
|
||||
if (wd->ini_key == nullptr) continue;
|
||||
if (wd->ini_key.empty()) continue;
|
||||
IniSaveWindowSettings(ini, wd->ini_key, wd);
|
||||
}
|
||||
ini.SaveToDisk(_windows_file);
|
||||
|
|
|
@ -166,7 +166,7 @@ struct HotkeyList;
|
|||
*/
|
||||
struct WindowDesc {
|
||||
|
||||
WindowDesc(WindowPosition default_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad,
|
||||
WindowDesc(WindowPosition default_pos, std::string_view ini_key, int16_t def_width_trad, int16_t def_height_trad,
|
||||
WindowClass window_class, WindowClass parent_class, WindowDefaultFlags flags,
|
||||
const std::span<const NWidgetPart> nwid_parts, HotkeyList *hotkeys = nullptr,
|
||||
const std::source_location location = std::source_location::current());
|
||||
|
@ -177,7 +177,7 @@ struct WindowDesc {
|
|||
const WindowPosition default_pos; ///< Preferred position of the window. @see WindowPosition()
|
||||
const WindowClass cls; ///< Class of the window, @see WindowClass.
|
||||
const WindowClass parent_cls; ///< Class of the parent window. @see WindowClass
|
||||
const char *ini_key; ///< Key to store window defaults in openttd.cfg. \c nullptr if nothing shall be stored.
|
||||
const std::string_view ini_key; ///< Key to store window defaults in openttd.cfg. An empty string if nothing shall be stored.
|
||||
const WindowDefaultFlags flags; ///< Flags. @see WindowDefaultFlag
|
||||
const std::span<const NWidgetPart> nwid_parts; ///< Span of nested widget parts describing the window.
|
||||
const HotkeyList *hotkeys; ///< Hotkeys for the window.
|
||||
|
|
Loading…
Reference in New Issue