(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.
authorrubidium
Sun, 13 Jan 2008 12:08:35 +0000
changeset 8266 08d1ff0b6018
parent 8265 86530c22f883
child 8267 ea6dbc5b2148
(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.
src/roadveh_cmd.cpp
--- a/src/roadveh_cmd.cpp	Sun Jan 13 01:39:22 2008 +0000
+++ b/src/roadveh_cmd.cpp	Sun Jan 13 12:08:35 2008 +0000
@@ -895,6 +895,7 @@
 	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 @@
 		/* 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)) {