(svn r5854) -Fix: [elrails] now electric engines are stopped if they enter a non-electrified depot even if they would have left right away if the depot had catenary
authorbjarni
Sat, 12 Aug 2006 11:08:02 +0000
changeset 4252 e06bade21a2e
parent 4251 85befcd5f435
child 4253 6fadea8a8043
(svn r5854) -Fix: [elrails] now electric engines are stopped if they enter a non-electrified depot even if they would have left right away if the depot had catenary
this solves the issue where electric engines in a certain situation could leave non-electrified depots, turn around and enter all the time
train_cmd.c
--- a/train_cmd.c	Sat Aug 12 10:41:29 2006 +0000
+++ b/train_cmd.c	Sat Aug 12 11:08:02 2006 +0000
@@ -2079,6 +2079,13 @@
 		if (u->u.rail.track != 0x80 || u->tile != v->tile) return false;
 	}
 
+	// if the train got no power, then keep it in the depot
+	if (v->u.rail.cached_power == 0) {
+		v->vehstatus |= VS_STOPPED;
+		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		return true;
+	}
+
 	if (v->u.rail.force_proceed == 0) {
 		if (++v->load_unload_time_rem < 37) {
 			InvalidateWindowClasses(WC_TRAINS_LIST);