Add console command to offer a company for sale

This commit is contained in:
Jonathan G Rennison
2021-10-24 00:11:51 +01:00
parent ec8512e2ea
commit 296987153b
3 changed files with 38 additions and 0 deletions

View File

@@ -943,6 +943,18 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
break;
}
case CCA_SALE: {
Company *c = Company::GetIfValid(company_id);
if (c == nullptr) return CMD_ERROR;
if (!(flags & DC_EXEC)) return CommandCost();
c->bankrupt_value = CalculateCompanyValue(c, false);
c->bankrupt_asked = 1 << c->index; // Don't ask the owner
c->bankrupt_timeout = 0;
break;
}
default: return CMD_ERROR;
}