Changeset - r21951:9f1f828dbafc
[Not reviewed]
master
0 1 0
michi_cc - 9 years ago 2015-01-01 22:39:35
michi_cc@openttd.org
(svn r27106) -Fix [FS#6176]: Use the actual max speed of the vehicle in front when determining if a RV can overtake.
1 file changed with 9 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -806,12 +806,6 @@ static void RoadVehCheckOvertake(RoadVeh
 
	od.v = v;
 
	od.u = u;
 

	
 
	if (u->vcache.cached_max_speed >= v->vcache.cached_max_speed &&
 
			!(u->vehstatus & VS_STOPPED) &&
 
			u->cur_speed != 0) {
 
		return;
 
	}
 

	
 
	/* Trams can't overtake other trams */
 
	if (v->roadtype == ROADTYPE_TRAM) return;
 

	
 
@@ -827,6 +821,15 @@ static void RoadVehCheckOvertake(RoadVeh
 
	/* Check if vehicle is in a road stop, depot, tunnel or bridge or not on a straight road */
 
	if (v->state >= RVSB_IN_ROAD_STOP || !IsStraightRoadTrackdir((Trackdir)(v->state & RVSB_TRACKDIR_MASK))) return;
 

	
 
	/* Can't overtake a vehicle that is moving faster than us. If the vehicle in front is
 
	 * accelerating, take the maximum speed for the comparison, else the current speed. */
 
	int u_speed = u->GetAcceleration() > 0 ? u->GetCurrentMaxSpeed() : u->cur_speed;
 
	if (u_speed >= v->GetCurrentMaxSpeed() &&
 
			!(u->vehstatus & VS_STOPPED) &&
 
			u->cur_speed != 0) {
 
		return;
 
	}
 

	
 
	od.trackdir = DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
 

	
 
	/* Are the current and the next tile suitable for overtaking?
0 comments (0 inline, 0 general)