summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-08 00:15:15 +0000
committerrubidium <rubidium@openttd.org>2009-12-08 00:15:15 +0000
commit1e416f90fa4b44c379f53847b5d0a2d0ecebc055 (patch)
treec0babdf0d889ee2673fe9381c901fdd72f38b307 /src/roadveh_cmd.cpp
parent151ac000b0c1439125c687e346bfff86d6bd683c (diff)
downloadopenttd-1e416f90fa4b44c379f53847b5d0a2d0ecebc055.tar.xz
(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
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 243d711e4..50de1073f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -680,7 +680,7 @@ static Vehicle *EnumCheckRoadVehClose(Vehicle *v, void *data)
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(RoadVehicle *v, int x, int y, Direction d
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(RoadVehicle *v, bool first)
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);