Decline company takeover offer on company's behalf if company has no client

This commit is contained in:
Jonathan G Rennison
2021-10-24 12:23:52 +01:00
parent 296987153b
commit 28fd549808

View File

@@ -37,6 +37,7 @@
#include "zoning.h" #include "zoning.h"
#include "tbtr_template_vehicle_func.h" #include "tbtr_template_vehicle_func.h"
#include "widgets/statusbar_widget.h" #include "widgets/statusbar_widget.h"
#include "core/backup_type.hpp"
#include "debug_desync.h" #include "debug_desync.h"
#include "table/strings.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))); AI::NewEvent(best->index, new ScriptEventCompanyAskMerger(c->index, ClampToI32(c->bankrupt_value)));
} else if (IsInteractiveCompany(best->index)) { } else if (IsInteractiveCompany(best->index)) {
ShowBuyCompanyDialog(c->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<CompanyID> cur_company(_current_company, best->index, FILE_LINE);
DoCommandP(0, c->index, 0, CMD_DECLINE_BUY_COMPANY);
cur_company.Restore();
} }
} }