summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-18 21:35:55 +0000
committerrubidium <rubidium@openttd.org>2009-12-18 21:35:55 +0000
commit21324b69d962fd52f866ff6005aa0bae91a4686b (patch)
tree6a8077bf727bc74eaa8bc1e1d7f8c8ef376adcb8
parent6f1982d15149a3649a6ae7f24caaeace8d3809d9 (diff)
downloadopenttd-21324b69d962fd52f866ff6005aa0bae91a4686b.tar.xz
(svn r18532) -Codechange/Fix (r18404): don't leave the road stop between tiles, just stay on it. This prevents the rare cases where a road vehicle would stop exactly on the border where it could not load
-rw-r--r--src/roadveh_cmd.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 1d4b9774f..322b33c0b 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1313,7 +1313,23 @@ again:
v->cur_speed = 0;
return false;
}
- if (IsRoadStop(v->tile)) RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
+
+ /* If we are a drive through road stop and the next tile is of
+ * the same road stop and the next tile isn't this one (i.e. we
+ * are not reversing), then keep the reservation and state.
+ * This way we will not be shortly unregister from the road
+ * stop. It also makes it possible to load when on the edge of
+ * two road stops; otherwise you could get vehicles that should
+ * be loading but are not actually loading. */
+ if (IsDriveThroughStopTile(v->tile) &&
+ RoadStop::IsDriveThroughRoadStopContinuation(v->tile, tile) &&
+ v->tile != tile) {
+ /* So, keep 'our' state */
+ dir = (Trackdir)v->state;
+ } else if (IsRoadStop(v->tile)) {
+ /* We're not continuing our drive through road stop, so leave. */
+ RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
+ }
}
if (!HasBit(r, VETS_ENTERED_WORMHOLE)) {