summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-13 12:08:35 +0000
committerrubidium <rubidium@openttd.org>2008-01-13 12:08:35 +0000
commitcc52a56052a58e8566bbc04693c7ac8b66d033f1 (patch)
treefd135659486f67578f5faac5cf4128b55155fce8 /src
parent079abbd04be8e997a0d09eb89ad03884a4e12d00 (diff)
downloadopenttd-cc52a56052a58e8566bbc04693c7ac8b66d033f1.tar.xz
(svn r11830) -Fix [FS#1625]: road vehicles would not wait in line, but at a single point on bridges. Based on a patch by SmatZ.
Diffstat (limited to 'src')
-rw-r--r--src/roadveh_cmd.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 0dd9d955c..8cb3cb67f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -895,6 +895,7 @@ static Vehicle* RoadVehFindCloseTo(Vehicle* v, int x, int y, Direction dir)
rvf.veh = v;
if (front->u.road.state == RVSB_WORMHOLE) {
u = (Vehicle*)VehicleFromPos(v->tile, &rvf, EnumCheckRoadVehClose);
+ if (u == NULL) u = (Vehicle*)VehicleFromPos(GetOtherTunnelBridgeEnd(v->tile), &rvf, EnumCheckRoadVehClose);
} else {
u = (Vehicle*)VehicleFromPosXY(x, y, &rvf, EnumCheckRoadVehClose);
}
@@ -1511,10 +1512,12 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
/* Vehicle is entering a depot or is on a bridge or in a tunnel */
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
- const Vehicle *u = RoadVehFindCloseTo(v, gp.x, gp.y, v->direction);
- if (u != NULL && u->First()->cur_speed < v->cur_speed) {
- v->cur_speed = u->First()->cur_speed;
- return false;
+ if (IsRoadVehFront(v)) {
+ const Vehicle *u = RoadVehFindCloseTo(v, gp.x, gp.y, v->direction);
+ if (u != NULL) {
+ v->cur_speed = u->First()->cur_speed;
+ return false;
+ }
}
if ((IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {