(svn r11229) -Fix [FS#1307]: one could sell vehicles that were crashed in a depot, which would still yield money.
authorrubidium
Mon, 08 Oct 2007 20:06:37 +0000
changeset 8191 3ffc17ef4ff5
parent 8190 efd1f3b110a2
child 8192 dcc489afe013
(svn r11229) -Fix [FS#1307]: one could sell vehicles that were crashed in a depot, which would still yield money.
src/aircraft_cmd.cpp
src/lang/english.txt
src/roadveh_cmd.cpp
src/ship_cmd.cpp
src/train_cmd.cpp
--- a/src/aircraft_cmd.cpp	Mon Oct 08 19:56:21 2007 +0000
+++ b/src/aircraft_cmd.cpp	Mon Oct 08 20:06:37 2007 +0000
@@ -487,6 +487,8 @@
 	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) {
--- a/src/lang/english.txt	Mon Oct 08 19:56:21 2007 +0000
+++ b/src/lang/english.txt	Mon Oct 08 20:06:37 2007 +0000
@@ -2782,6 +2782,8 @@
 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.
--- a/src/roadveh_cmd.cpp	Mon Oct 08 19:56:21 2007 +0000
+++ b/src/roadveh_cmd.cpp	Mon Oct 08 20:06:37 2007 +0000
@@ -359,6 +359,8 @@
 
 	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)) {
--- a/src/ship_cmd.cpp	Mon Oct 08 19:56:21 2007 +0000
+++ b/src/ship_cmd.cpp	Mon Oct 08 20:06:37 2007 +0000
@@ -911,6 +911,8 @@
 
 	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()) {
--- a/src/train_cmd.cpp	Mon Oct 08 19:56:21 2007 +0000
+++ b/src/train_cmd.cpp	Mon Oct 08 20:06:37 2007 +0000
@@ -1216,6 +1216,8 @@
 
 	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();