HomeWildfire Games

Fix visual-replays not processing turn 0 commands.

Description

Fix visual-replays not processing turn 0 commands.

Use FinishedOwnCommands, which is intented to plan commands for the N+2 turn, but can be used to run commands immediately by the replay manager, and unlike FinishedUpdate is called before the first update.

Reported by: Freagarach

Fixes #5546

Differential Revision: https://code.wildfiregames.com/D3067

Event Timeline

vladislavbelov added inline comments.
/ps/trunk/source/simulation2/system/ReplayTurnManager.cpp
63

Is it guaranteed that turn is greater or equal to COMMAND_DELAY?

wraitii added inline comments.Dec 1 2020, 12:14 PM
/ps/trunk/source/simulation2/system/ReplayTurnManager.cpp
63

Yes, it's actually called with "m_CurrentTurn + COMMAND_DELAY"

vladislavbelov added inline comments.Dec 1 2020, 12:22 PM
/ps/trunk/source/simulation2/system/ReplayTurnManager.cpp
63

I see no guarantees (comments or additional checks) that it can't be called with just a m_CurrentTurn.

wraitii added inline comments.Dec 1 2020, 12:25 PM
/ps/trunk/source/simulation2/system/ReplayTurnManager.cpp
63

Well, there are none, but doing that would completely break the MP implementation, so I don't think it's happening soon.

That said, adding an ENSURE probably wouldn't hurt here, if we had contracts, it'd certainly be part of it.