Changeset - r13888:b0e99b89b743
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-12-08 00:15:15
rubidium@openttd.org
(svn r18428) -Fix: if lots of road vehicles are leaving a depot and the first in the hash linked list is basically the last of the vehicles to leave the depot then due to the 'jam prevention' code all vehicles would fairly quickly increase the blocked counter and drive off all simultaniously
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -680,7 +680,7 @@ static Vehicle *EnumCheckRoadVehClose(Ve
 
	return NULL;
 
}
 

	
 
static RoadVehicle *RoadVehFindCloseTo(RoadVehicle *v, int x, int y, Direction dir)
 
static RoadVehicle *RoadVehFindCloseTo(RoadVehicle *v, int x, int y, Direction dir, bool update_blocked_ctr = true)
 
{
 
	RoadVehFindData rvf;
 
	RoadVehicle *front = v->First();
 
@@ -709,7 +709,7 @@ static RoadVehicle *RoadVehFindCloseTo(R
 
		return NULL;
 
	}
 

	
 
	if (++front->blocked_ctr > 1480) return NULL;
 
	if (update_blocked_ctr && ++front->blocked_ctr > 1480) return NULL;
 

	
 
	return RoadVehicle::From(rvf.best);
 
}
 
@@ -1047,7 +1047,7 @@ static bool RoadVehLeaveDepot(RoadVehicl
 
	int y = TileY(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].y & 0xF);
 

	
 
	if (first) {
 
		if (RoadVehFindCloseTo(v, x, y, v->direction) != NULL) return true;
 
		if (RoadVehFindCloseTo(v, x, y, v->direction, false) != NULL) return true;
 

	
 
		VehicleServiceInDepot(v);
 

	
0 comments (0 inline, 0 general)