FIX: Prediction.CorrectHistory() now adjusts afterIndex after dequeing!

This commit is contained in:
mischa 2024-03-14 17:20:13 +08:00
parent 65ce7d35cb
commit 9bff895564

View File

@ -110,7 +110,11 @@ public static T CorrectHistory<T>(
// respect the limit
// TODO unit test to check if it respects max size
if (history.Count >= stateHistoryLimit)
{
history.Dequeue();
// if we remove one entry, then we also need to adjust the afterIndex
afterIndex -= 1;
}
// unlike with SortedList, we don't insert corrections for RingBuffer.
// we only correct the values after it since insertions would be awkward for RingBuffer.