diff options
author | tron <tron@openttd.org> | 2004-11-23 20:25:18 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2004-11-23 20:25:18 +0000 |
commit | 0b3cceb21de2111ec5b91fd866ad02e692174d28 (patch) | |
tree | 5c1e3c6ee38194256906ddb1dc0e54d4c8860e84 | |
parent | c5b0ecac4f06a36c6ff0ca0f4c79d7943f3d023a (diff) | |
download | openttd-0b3cceb21de2111ec5b91fd866ad02e692174d28.tar.xz |
(svn r785) -Fix: A train can leave and enter the same depot at the same time, then the trai simply got stuck
-rw-r--r-- | train_cmd.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/train_cmd.c b/train_cmd.c index fcb2837c6..edc7a6834 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1261,18 +1261,11 @@ static void TrainPlayLeaveStationSound(Vehicle *v) static bool CheckTrainStayInDepot(Vehicle *v) { Vehicle *u; - if (v->u.rail.track != 0x80) // first wagon (eg engine) in depot - return false; - - // make sure that all vehicles are in the depot - u = GetLastVehicleInChain(v); - if (u->u.rail.track != 0x80) - return false; - // fix hung train if both ends are in depots (when here first wagon and last wagon is in depot) - // both first and last should be in the same depot, eg on the same tile - if (v->tile != u->tile) - return false; + // bail out if not all wagons are in the same depot or not in a depot at all + for (u = v; u != NULL; u = u->next) + if (u->u.rail.track != 0x80 || u->tile != v->tile) + return false; if (v->u.rail.force_proceed == 0) { if (++v->load_unload_time_rem < 37) |