Realistic braking: Cache train overall z position

Refresh cache at a variable rate depending on train length and
weight distribution
This commit is contained in:
Jonathan G Rennison
2022-06-03 00:41:41 +01:00
parent c238bd5012
commit 99ee4b13ce
9 changed files with 57 additions and 16 deletions

View File

@@ -90,6 +90,8 @@ struct TrainReservationLookAhead {
uint16 speed_restriction;
std::deque<TrainReservationLookAheadItem> items;
std::deque<TrainReservationLookAheadCurve> 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
int32 RealEndPosition() const
{