@@ -181,12 +181,15 @@ export default class Match {
181181 const currentTurnNumber = this . currentRound . turnNumber
182182
183183 this . _currentSimulationStep += deltaTime * MAX_SIMULATION_STEPS
184+
184185 if ( this . playbackPerTurn ) {
186+ // This works because of the way floor works
187+ const deltaTurns = Math . floor ( this . _currentSimulationStep / MAX_SIMULATION_STEPS )
185188 if ( this . _currentSimulationStep >= MAX_SIMULATION_STEPS ) {
186- this . _stepTurn ( 1 )
189+ this . _stepTurn ( deltaTurns )
187190 this . _currentSimulationStep = 0
188191 } else if ( this . _currentSimulationStep < 0 ) {
189- this . _stepTurn ( - 1 )
192+ this . _stepTurn ( deltaTurns )
190193 this . _currentSimulationStep = MAX_SIMULATION_STEPS - 1
191194 }
192195 } else {
@@ -230,6 +233,8 @@ export default class Match {
230233 }
231234
232235 private _updateSimulationRoundsByTime ( deltaTime : number ) : void {
236+ // This works because of the way floor works
237+ const deltaRounds = Math . floor ( this . _currentSimulationStep / MAX_SIMULATION_STEPS )
233238 if ( this . currentRound . roundNumber == this . maxRound && deltaTime > 0 ) {
234239 // If we are at the end, round the simulation to the max value
235240 this . _currentSimulationStep = Math . min ( this . _currentSimulationStep , MAX_SIMULATION_STEPS )
@@ -239,12 +244,12 @@ export default class Match {
239244 } else if ( this . _currentSimulationStep < 0 ) {
240245 // If we are going in reverse, step the rounds back by one. Also,
241246 // apply all turns for that round so that the transition is smooth
242- this . _stepRound ( - 1 )
247+ this . _stepRound ( deltaRounds )
243248 this . currentRound . jumpToTurn ( this . currentRound . turnsLength )
244249 this . _currentSimulationStep = MAX_SIMULATION_STEPS - 1
245250 } else if ( this . _currentSimulationStep >= MAX_SIMULATION_STEPS ) {
246251 // If we are going forward, simply step the turn
247- this . _stepRound ( 1 )
252+ this . _stepRound ( deltaRounds )
248253 }
249254 }
250255
0 commit comments