diff options
author | rubidium <rubidium@openttd.org> | 2007-10-08 20:06:37 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-08 20:06:37 +0000 |
commit | b6c9bc80cfef26490562b0c7a07a1adfc6d08ede (patch) | |
tree | 558ec5c75aee553211edcce8233c8d5af44e12e8 | |
parent | cb6cdf7978501a894d0322b4371fa449320ceb28 (diff) | |
download | openttd-b6c9bc80cfef26490562b0c7a07a1adfc6d08ede.tar.xz |
(svn r11229) -Fix [FS#1307]: one could sell vehicles that were crashed in a depot, which would still yield money.
-rw-r--r-- | src/aircraft_cmd.cpp | 2 | ||||
-rw-r--r-- | src/lang/english.txt | 2 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 2 | ||||
-rw-r--r-- | src/ship_cmd.cpp | 2 | ||||
-rw-r--r-- | src/train_cmd.cpp | 2 |
5 files changed, 10 insertions, 0 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index b8bbf8d07..8dad10575 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -487,6 +487,8 @@ CommandCost CmdSellAircraft(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 (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE); + SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); if (flags & DC_EXEC) { diff --git a/src/lang/english.txt b/src/lang/english.txt index 1f8aa3d33..70c6c45a0 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2782,6 +2782,8 @@ STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{ENGINE} 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_TIMETABLE_VEHICLE :{WHITE}Can't timetable vehicle... STR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations. STR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}This vehicle is not stopping at this station. diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 012747bba..7f7799bfb 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -359,6 +359,8 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR; + if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE); + SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); if (!CheckRoadVehInDepotStopped(v)) { diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index b4859cc73..8c17ccf20 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -911,6 +911,8 @@ CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR; + if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE); + SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); if (!v->IsStoppedInDepot()) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 1b725e84a..4757db3d2 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1216,6 +1216,8 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR; + if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE); + SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); while (IsArticulatedPart(v)) v = v->Previous(); |