Add error messages for vehicle build failure due to wrong depot owner and rail type

This commit is contained in:
Jonathan G Rennison 2019-05-18 13:19:43 +01:00
parent ee06258629
commit 8042150a35
3 changed files with 6 additions and 3 deletions

View File

@ -5429,6 +5429,9 @@ STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION :{WHITE}Change y
STR_ERROR_NO_VEHICLES_AVAILABLE_YET :{WHITE}No vehicles are available yet
STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION :{WHITE}Start a new game after {DATE_SHORT} or use a NewGRF that provides early vehicles
STR_ERROR_CANT_PURCHASE_OTHER_COMPANY_DEPOT :{WHITE}Depot is owned by another company, and building vehicles there is not allowed.
STR_ERROR_DEPOT_HAS_WRONG_RAIL_TYPE :{WHITE}Depot cannot be used to build trains with this rail type.
# Specific vehicle errors
STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL :{WHITE}Can't make train pass signal at danger...
STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN :{WHITE}Can't reverse direction of train...

View File

@ -940,7 +940,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin
/* Check if depot and new engine uses the same kind of tracks *
* We need to see if the engine got power on the tile to avoid electric engines in non-electric depots */
if (!HasPowerOnRail(rvi->railtype, GetRailType(tile))) return CMD_ERROR;
if (!HasPowerOnRail(rvi->railtype, GetRailType(tile))) return_cmd_error(STR_ERROR_DEPOT_HAS_WRONG_RAIL_TYPE);
if (flags & DC_EXEC) {
DiagDirection dir = GetRailDepotDirection(tile);

View File

@ -95,10 +95,10 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
VehicleType type = GetDepotVehicleType(tile);
if (!IsTileOwner(tile, _current_company)) {
if (!_settings_game.economy.infrastructure_sharing[type]) return CMD_ERROR;
if (!_settings_game.economy.infrastructure_sharing[type]) return_cmd_error(STR_ERROR_CANT_PURCHASE_OTHER_COMPANY_DEPOT);
const Company *c = Company::GetIfValid(GetTileOwner(tile));
if (c == nullptr || !c->settings.infra_others_buy_in_depot[type]) return CMD_ERROR;
if (c == nullptr || !c->settings.infra_others_buy_in_depot[type]) return_cmd_error(STR_ERROR_CANT_PURCHASE_OTHER_COMPANY_DEPOT);
}
/* Validate the engine type. */