(svn r5853) -Fix: [elrails] FS#178 Electric Trains can leave Conventional Depot
authorbjarni
Sat, 12 Aug 2006 10:41:29 +0000
changeset 4251 e8f69de723e1
parent 4250 e0c5877d7d45
child 4252 89a4206d3cb5
(svn r5853) -Fix: [elrails] FS#178 Electric Trains can leave Conventional Depot
now the user will get an error if he tries to start the train and the status bar will say "no power" instead of "stopped"
Electric trains already driving in and out of non-electrified depots will still do so, but you can't start new ones
lang/english.txt
train_cmd.c
train_gui.c
--- a/lang/english.txt	Fri Aug 11 13:51:04 2006 +0000
+++ b/lang/english.txt	Sat Aug 12 10:41:29 2006 +0000
@@ -2529,6 +2529,8 @@
 STR_TRAIN_STOPPING                                              :{RED}Stopping
 STR_TRAIN_STOPPING_VEL                                          :{RED}Stopping, {VELOCITY}
 STR_INCOMPATIBLE_RAIL_TYPES                                     :Incompatible rail types
+STR_TRAIN_NO_POWER                                              :{RED}No power
+STR_TRAIN_START_NO_CATENARY                                     :This track lacks catenary, so the train can't start
 
 ##id 0x9000
 STR_9000_ROAD_VEHICLE_IN_THE_WAY                                :{WHITE}Road vehicle in the way
--- a/train_cmd.c	Fri Aug 11 13:51:04 2006 +0000
+++ b/train_cmd.c	Sat Aug 12 10:41:29 2006 +0000
@@ -1243,6 +1243,8 @@
 		return_cmd_error(error);
 	}
 
+	if (v->vehstatus & VS_STOPPED && v->u.rail.cached_power == 0) return_cmd_error(STR_TRAIN_START_NO_CATENARY);
+
 	if (flags & DC_EXEC) {
 		if (v->vehstatus & VS_STOPPED && v->u.rail.track == 0x80) {
 			DeleteVehicleNews(p1, STR_8814_TRAIN_IS_WAITING_IN_DEPOT);
--- a/train_gui.c	Fri Aug 11 13:51:04 2006 +0000
+++ b/train_gui.c	Sat Aug 12 10:41:29 2006 +0000
@@ -954,7 +954,11 @@
 			str = STR_885C_BROKEN_DOWN;
 		} else if (v->vehstatus & VS_STOPPED) {
 			if (v->u.rail.last_speed == 0) {
-				str = STR_8861_STOPPED;
+				if (v->u.rail.cached_power == 0) {
+					str = STR_TRAIN_NO_POWER;
+				} else {
+					str = STR_8861_STOPPED;
+				}
 			} else {
 				SetDParam(0, v->u.rail.last_speed);
 				str = STR_TRAIN_STOPPING + _patches.vehicle_speed;