1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00

Codechange: Pass WindowDesc by reference instead of pointer. (#12771)

WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
This commit is contained in:
Peter Nelson
2024-06-11 08:58:03 +01:00
committed by GitHub
parent 18bce69623
commit 4cf6d1dd79
68 changed files with 293 additions and 301 deletions

View File

@@ -65,7 +65,7 @@ struct ScriptListWindow : public Window {
* @param slot The company we're changing the Script for.
* @param show_all Whether to show all available versions.
*/
ScriptListWindow(WindowDesc *desc, CompanyID slot, bool show_all) : Window(desc),
ScriptListWindow(WindowDesc &desc, CompanyID slot, bool show_all) : Window(desc),
slot(slot), show_all(show_all)
{
if (slot == OWNER_DEITY) {
@@ -277,7 +277,7 @@ static WindowDesc _script_list_desc(
void ShowScriptListWindow(CompanyID slot, bool show_all)
{
CloseWindowByClass(WC_SCRIPT_LIST);
new ScriptListWindow(&_script_list_desc, slot, show_all);
new ScriptListWindow(_script_list_desc, slot, show_all);
}
@@ -302,7 +302,7 @@ struct ScriptSettingsWindow : public Window {
* @param desc The description of the window.
* @param slot The company we're changing the settings for.
*/
ScriptSettingsWindow(WindowDesc *desc, CompanyID slot) : Window(desc),
ScriptSettingsWindow(WindowDesc &desc, CompanyID slot) : Window(desc),
slot(slot),
clicked_button(-1),
clicked_dropdown(false),
@@ -622,7 +622,7 @@ void ShowScriptSettingsWindow(CompanyID slot)
{
CloseWindowByClass(WC_SCRIPT_LIST);
CloseWindowByClass(WC_SCRIPT_SETTINGS);
new ScriptSettingsWindow(&_script_settings_desc, slot);
new ScriptSettingsWindow(_script_settings_desc, slot);
}
@@ -779,7 +779,7 @@ struct ScriptDebugWindow : public Window {
* @param desc The description of the window.
* @param number The window number (actually unused).
*/
ScriptDebugWindow(WindowDesc *desc, WindowNumber number, Owner show_company) : Window(desc), break_editbox(MAX_BREAK_STR_STRING_LENGTH)
ScriptDebugWindow(WindowDesc &desc, WindowNumber number, Owner show_company) : Window(desc), break_editbox(MAX_BREAK_STR_STRING_LENGTH)
{
this->filter = ScriptDebugWindow::initial_state;
this->break_string_filter = {&this->filter.case_sensitive_break_check, false};
@@ -1325,7 +1325,7 @@ Window *ShowScriptDebugWindow(CompanyID show_company, bool new_window)
return w;
}
}
return new ScriptDebugWindow(&_script_debug_desc, i, show_company);
return new ScriptDebugWindow(_script_debug_desc, i, show_company);
} else {
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
}