Fix assertion error on [allow_undo] misuse

Previously it could happen that the replay recorder was not at end after redoing if redo() pushed additional user choices to the recorderwhihc were not used by the actual code (this can happen if the game is out of sync)
This commit is contained in:
gfgtdf 2024-10-24 23:08:25 +02:00 committed by GitHub
parent c284a080e3
commit 75be3f0c29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -406,6 +406,10 @@ void undo_list::redo()
redos_list temp;
temp.swap(redos_);
synced_context::run(commandname, data, /*use_undo*/ true, /*show*/ true, error_handler);
if(!resources::recorder->at_end()) {
error_handler(_"Unhandled choices while redoing");
resources::recorder->set_to_end();
}
temp.swap(redos_);
// Screen updates.