diff options
author | bjarni <bjarni@openttd.org> | 2006-10-08 21:46:05 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-10-08 21:46:05 +0000 |
commit | 2e7dc02b91ed654483cace67bcc4324ab26ed001 (patch) | |
tree | 2378ce093f45f97767d4df10780cfa0c304e72a1 /vehicle.c | |
parent | ec809c5d71cf9ccb37d8ebe04c583d2fe566af9e (diff) | |
download | openttd-2e7dc02b91ed654483cace67bcc4324ab26ed001.tar.xz |
(svn r6697) -Fix: [order refit] if an order refit fails, the vehicle is now stopped and the player gets a message (like vehicle stopped in depot)
This should prevent a vehicle from failing to be refitted and then show up and block a station with full load.
In such a case, it's better to stop in a depot (that will not stop any other vehicles) and notify the owner
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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)) { |