From 28fd5498083c58a973dbe39c3c7e8b4cf2be980c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 24 Oct 2021 12:23:52 +0100 Subject: [PATCH] Decline company takeover offer on company's behalf if company has no client --- src/company_cmd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 29824ff1ca..1a49022071 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -37,6 +37,7 @@ #include "zoning.h" #include "tbtr_template_vehicle_func.h" #include "widgets/statusbar_widget.h" +#include "core/backup_type.hpp" #include "debug_desync.h" #include "table/strings.h" @@ -714,6 +715,11 @@ static void HandleBankruptcyTakeover(Company *c) AI::NewEvent(best->index, new ScriptEventCompanyAskMerger(c->index, ClampToI32(c->bankrupt_value))); } else if (IsInteractiveCompany(best->index)) { ShowBuyCompanyDialog(c->index); + } else if (!_networking || (_network_server && !NetworkCompanyHasClients(best->index))) { + /* This company can never accept the offer as there are no clients connected, decline the offer on the company's behalf */ + Backup cur_company(_current_company, best->index, FILE_LINE); + DoCommandP(0, c->index, 0, CMD_DECLINE_BUY_COMPANY); + cur_company.Restore(); } }