diff options
author | smatz <smatz@openttd.org> | 2007-12-27 14:10:47 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2007-12-27 14:10:47 +0000 |
commit | 38f0e422ac60cf86dd3dd08812f72ee1ec06c96c (patch) | |
tree | d00313ff1fa98add9f7bf3b2cbc41ad0c640eab3 /src | |
parent | 384503e7d37f4b68c1480f6e6ca81adf84ef137d (diff) | |
download | openttd-38f0e422ac60cf86dd3dd08812f72ee1ec06c96c.tar.xz |
(svn r11707) -Fix: do not allow refitting flooded (destroyed) vehicles
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft_cmd.cpp | 1 | ||||
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 1 | ||||
-rw-r--r-- | src/ship_cmd.cpp | 6 | ||||
-rw-r--r-- | src/train_cmd.cpp | 1 |
5 files changed, 6 insertions, 4 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 7decc69e0..885028422 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -640,6 +640,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR; if (!v->IsStoppedInDepot()) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED); + if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE); /* Check cargo */ CargoID new_cid = GB(p2, 0, 8); diff --git a/src/lang/english.txt b/src/lang/english.txt index 3fa988c34..981487faa 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2796,6 +2796,7 @@ STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}New {STRING} now available! - {ENGINE} STR_CAN_T_SELL_DESTROYED_VEHICLE :{WHITE}Can't sell destroyed vehicle... +STR_CAN_T_REFIT_DESTROYED_VEHICLE :{WHITE}Can't refit destroyed vehicle... STR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Can't timetable vehicle... STR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations. diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 772f5fba0..83e6f7c42 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -2134,6 +2134,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR; if (!CheckRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE); + if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE); if (new_cid >= NUM_CARGO) return CMD_ERROR; diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index ea4ba017e..b126db9bb 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -1067,10 +1067,8 @@ CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) v = GetVehicle(p1); if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR; - - if (!v->IsStoppedInDepot()) { - return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN); - } + if (!v->IsStoppedInDepot()) return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN); + if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE); /* Check cargo */ if (!ShipVehInfo(v->engine_type)->refittable) return CMD_ERROR; diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 92b20098c..a1b0b8cb0 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1720,6 +1720,7 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR; if (CheckTrainStoppedInDepot(v) < 0) return_cmd_error(STR_TRAIN_MUST_BE_STOPPED); + if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE); /* Check cargo */ if (new_cid >= NUM_CARGO) return CMD_ERROR; |