Use ring buffers for train lookahead items and curves
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "direction_type.h"
|
#include "direction_type.h"
|
||||||
#include "track_type.h"
|
#include "track_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
#include "core/ring_buffer.hpp"
|
||||||
|
|
||||||
TrackBits GetReservedTrackbits(TileIndex t);
|
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
|
int16 tunnel_bridge_reserved_tiles; ///< How many tiles a reservation into the tunnel/bridge currently extends into the wormhole
|
||||||
uint16 flags; ///< Flags (TrainReservationLookAheadFlags)
|
uint16 flags; ///< Flags (TrainReservationLookAheadFlags)
|
||||||
uint16 speed_restriction;
|
uint16 speed_restriction;
|
||||||
std::deque<TrainReservationLookAheadItem> items;
|
ring_buffer<TrainReservationLookAheadItem> items;
|
||||||
std::deque<TrainReservationLookAheadCurve> curves;
|
ring_buffer<TrainReservationLookAheadCurve> curves;
|
||||||
int32 cached_zpos = 0; ///< Cached z position as used in TrainDecelerationStats
|
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
|
uint8 zpos_refresh_remaining = 0; ///< Remaining position updates before next refresh of cached_zpos
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user