Mercurial > hg > openttd
changeset 13898:e05224459a9f draft
(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
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 08 Dec 2009 00:15:15 +0000 |
parents | a12398584dcf |
children | 72c67db52eb2 |
files | src/roadveh_cmd.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -680,7 +680,7 @@ 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 @@ 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 @@ 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);