diff --git a/src/lang/english.txt b/src/lang/english.txt index e6fe5aebf3..47e50c9e90 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -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... diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index d17e6ed0d6..afacfa3acd 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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); diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 558a9bc1b1..16c8a12ab1 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -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. */