From 07385c36623ede05fbc4ac49076e1a26e349d731 Mon Sep 17 00:00:00 2001 From: glx22 Date: Mon, 18 Jan 2021 15:33:39 +0100 Subject: Fix: Use the same safety checks as 'stop_ai' for 'reload_ai' --- src/ai/ai_gui.cpp | 3 ++- src/console_cmds.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 30edc9940..8db22e41b 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1406,7 +1406,8 @@ struct AIDebugWindow : public Window { this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check); this->SetWidgetDisabledState(WID_AID_SETTINGS, ai_debug_company == INVALID_COMPANY); - this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY); + extern CompanyID _local_company; + this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY || ai_debug_company == _local_company); this->SetWidgetDisabledState(WID_AID_CONTINUE_BTN, ai_debug_company == INVALID_COMPANY || (ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company))); } diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 140d91e70..f701df034 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1248,7 +1248,8 @@ DEF_CONSOLE_CMD(ConReloadAI) return true; } - if (Company::IsHumanID(company_id)) { + /* In offline mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */ + if (Company::IsHumanID(company_id) || company_id == _local_company) { IConsoleWarning("Company is not controlled by an AI."); return true; } @@ -1285,6 +1286,7 @@ DEF_CONSOLE_CMD(ConStopAI) return true; } + /* In offline mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */ if (Company::IsHumanID(company_id) || company_id == _local_company) { IConsoleWarning("Company is not controlled by an AI."); return true; -- cgit v1.2.3-70-g09d2