Add company settings to enable competitors' to buy/renew in own depots.

This commit is contained in:
Jonathan G Rennison
2016-02-13 16:51:19 +00:00
parent 248ac0e263
commit a27bdbb3e2
5 changed files with 48 additions and 1 deletions

View File

@@ -86,9 +86,15 @@ CommandCost CmdBuildAircraft (TileIndex tile, DoCommandFlag flags, const Engin
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Elementary check for valid location. */
if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
if (!IsDepotTile(tile)) return CMD_ERROR;
VehicleType type = GetDepotVehicleType(tile);
if (!IsTileOwner(tile, _current_company)) {
if (!_settings_game.economy.infrastructure_sharing[type]) return CMD_ERROR;
const Company *c = Company::GetIfValid(GetTileOwner(tile));
if (c == NULL || !c->settings.infra_others_buy_in_depot[type]) return CMD_ERROR;
}
/* Validate the engine type. */
EngineID eid = GB(p1, 0, 16);