summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-12 11:08:02 +0000
committerbjarni <bjarni@openttd.org>2006-08-12 11:08:02 +0000
commitde4a96fd7a3a3fefb9119ffc4bf57cc27e8ae0a6 (patch)
tree792f29491c9f9308ed9ea752a47b36d4276b12a6 /train_cmd.c
parent466452c3513eb180a89e9ea3fd76c73cf5f97254 (diff)
downloadopenttd-de4a96fd7a3a3fefb9119ffc4bf57cc27e8ae0a6.tar.xz
(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
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index d36449b34..d2a34decc 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2079,6 +2079,13 @@ static bool CheckTrainStayInDepot(Vehicle *v)
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);