diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/roadveh_cmd.cpp | 6 | ||||
-rw-r--r-- | src/station_base.h | 1 |
2 files changed, 6 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); diff --git a/src/station_base.h b/src/station_base.h index 2859096da..97477324d 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -52,6 +52,7 @@ struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> { static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed static const uint LIMIT = 16; ///< The maximum amount of roadstops that are allowed at a single station static const uint MAX_BAY_COUNT = 2; ///< The maximum number of loading bays + static const uint MAX_VEHICLES = 64; ///< The maximum number of vehicles that can allocate a slot to this roadstop TileIndex xy; ///< Position on the map byte status; ///< Current status of the Stop. Like which spot is taken. Access using *Bay and *Busy functions. |