summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-01-09 17:09:53 +0000
committerglx <glx@openttd.org>2008-01-09 17:09:53 +0000
commitd133edd026b031ff45916f33bc2bed525e3c2f0b (patch)
tree57a94a99caee4e1815e786b0d3ded6d5585eeaed /src/economy.cpp
parent46650c54b6a13ef5980eadb24995481f1fd83712 (diff)
downloadopenttd-d133edd026b031ff45916f33bc2bed525e3c2f0b.tar.xz
(svn r11794) -Fix [FS#1632]: reversing a train when loading at a station with an adjacent station in the same axis crashed.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 31830323b..bdef0a6c1 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1548,7 +1548,10 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
return;
}
- if (v->type == VEH_TRAIN && !IsTileType(v->tile, MP_STATION)) {
+ StationID last_visited = v->last_station_visited;
+ Station *st = GetStation(last_visited);
+
+ if (v->type == VEH_TRAIN && (!IsTileType(v->tile, MP_STATION) || GetStationIndex(v->tile) != st->index)) {
/* The train reversed in the station. Take the "easy" way
* out and let the train just leave as it always did. */
SetBit(v->vehicle_flags, VF_LOADING_FINISHED);
@@ -1568,9 +1571,6 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
v->cur_speed = 0;
- StationID last_visited = v->last_station_visited;
- Station *st = GetStation(last_visited);
-
for (; v != NULL; v = v->Next()) {
if (v->cargo_cap == 0) continue;