diff options
author | rubidium <rubidium@openttd.org> | 2009-03-07 18:19:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-07 18:19:53 +0000 |
commit | 7c084bb3e60ecb597ef43e929678cded79ac4a18 (patch) | |
tree | 212e6face18faed611eadf98deae9104b9c6fd73 /src/roadveh_cmd.cpp | |
parent | 8c68010acee6ad6e6e2667b675fc8d669fb2192a (diff) | |
download | openttd-7c084bb3e60ecb597ef43e929678cded79ac4a18.tar.xz |
(svn r15635) -Fix [FS#2707]: don't allow more than 64 road vehicles to reserve a slot at a single road stop. 255 + 1 gives trouble, but 64 is even more than the roadstop would be able to handle within the slot timeout time.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r-- | src/roadveh_cmd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index f025e46ba..649c54312 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1691,7 +1691,7 @@ again: if (IsDriveThroughStopTile(next_tile) && (GetRoadStopType(next_tile) == type) && GetStationIndex(v->tile) == GetStationIndex(next_tile)) { RoadStop *rs_n = GetRoadStopByTile(next_tile, type); - if (rs_n->IsFreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY))) { + if (rs_n->IsFreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY)) && rs_n->num_vehicles < RoadStop::MAX_VEHICLES) { /* Bay in next stop along is free - use it */ ClearSlot(v); rs_n->num_vehicles++; @@ -1927,6 +1927,10 @@ void RoadVehicle::OnNewDay() ); /* Now we find the nearest road stop that has a free slot */ for (; rs != NULL; rs = rs->GetNextRoadStop(this)) { + if (rs->num_vehicles >= RoadStop::MAX_VEHICLES) { + DEBUG(ms, 4, " stop 0x%X's queue is full, not treating further", rs->xy); + continue; + } dist = RoadFindPathToStop(this, rs->xy); if (dist == UINT_MAX) { DEBUG(ms, 4, " stop 0x%X is unreachable, not treating further", rs->xy); |