From e958bdde9fa784d860514c04b64bc6ee6dc2fb5f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 18 Aug 2023 18:21:53 +0100 Subject: [PATCH] Use ring buffers for train lookahead items and curves --- src/pbs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pbs.h b/src/pbs.h index e62b343e74..a4bda0b964 100644 --- a/src/pbs.h +++ b/src/pbs.h @@ -14,6 +14,7 @@ #include "direction_type.h" #include "track_type.h" #include "vehicle_type.h" +#include "core/ring_buffer.hpp" TrackBits GetReservedTrackbits(TileIndex t); @@ -97,8 +98,8 @@ struct TrainReservationLookAhead { int16 tunnel_bridge_reserved_tiles; ///< How many tiles a reservation into the tunnel/bridge currently extends into the wormhole uint16 flags; ///< Flags (TrainReservationLookAheadFlags) uint16 speed_restriction; - std::deque items; - std::deque curves; + ring_buffer items; + ring_buffer curves; int32 cached_zpos = 0; ///< Cached z position as used in TrainDecelerationStats uint8 zpos_refresh_remaining = 0; ///< Remaining position updates before next refresh of cached_zpos