summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/english.txt2
-rw-r--r--vehicle.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 5c2244c42..db4b83ae1 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -3001,6 +3001,8 @@ STR_MASS_START_LIST_TIP :{BLACK}Click to
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Sign List - {COMMA} Sign{P "" s}
+STR_ORDER_REFIT_FAILED :{WHITE}Order refit failure stopped {STRING} {COMMA}
+
############ Lists rail types
STR_RAIL_VEHICLES :Rail Vehicles
diff --git a/vehicle.c b/vehicle.c
index c5fa769c4..59f547622 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -2535,7 +2535,24 @@ void VehicleEnterDepot(Vehicle *v)
_current_player = v->owner;
cost = DoCommand(v->tile, v->index, t.refit_cargo | t.refit_subtype << 8, DC_EXEC, CMD_REFIT_VEH(v->type));
- if (!CmdFailed(cost) && v->owner == _local_player && cost != 0) ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost);
+
+ if (CmdFailed(cost)) {
+ v->leave_depot_instantly = false; // We ensure that the vehicle stays in the depot
+ if (v->owner == _local_player) {
+ /* Notify the user that we stopped the vehicle */
+ switch (v->type) {
+ case VEH_Train: SetDParam(0, STR_019F_TRAIN); break;
+ case VEH_Road: SetDParam(0, STR_019C_ROAD_VEHICLE); break;
+ case VEH_Ship: SetDParam(0, STR_019E_SHIP); break;
+ case VEH_Aircraft: SetDParam(0, STR_019D_AIRCRAFT); break;
+ default: NOT_REACHED();
+ }
+ SetDParam(1, v->unitnumber);
+ AddNewsItem(STR_ORDER_REFIT_FAILED, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+ }
+ } else if (v->owner == _local_player && cost != 0) {
+ ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost);
+ }
}
if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {