diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 8d9634791651..e06795b11dac 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -791,8 +791,6 @@ void menu_handler::toggle_shroud_updates(int side_num) team ¤t_team = teams()[side_num - 1]; bool auto_shroud = current_team.auto_shroud_updates(); // If we're turning automatic shroud updates on, then commit all moves - // TODO: currently synced_context::run_in_synced_context("auto_shroud", replay_helper::get_auto_shroud(!auto_shroud)); - // Also calls update_shroud_now so eigher remove this one or that one. if (!auto_shroud) update_shroud_now(side_num); // Toggle the setting and record this. diff --git a/src/synced_commands.cpp b/src/synced_commands.cpp index 02e9481e39d8..01886f8a4086 100644 --- a/src/synced_commands.cpp +++ b/src/synced_commands.cpp @@ -342,9 +342,9 @@ SYNCED_COMMAND_HANDLER_FUNCTION(auto_shroud, child, use_undo, /*show*/, /*error team ¤t_team = (*resources::teams)[current_team_num - 1]; bool active = child["active"].to_bool(); - // Turning on automatic shroud causes vision to be updated. - if ( active ) - resources::undo_stack->commit_vision(); + // We cannot update shroud here like 'if(active) resources::undo_stack->commit_vision();'. + // Becasue the undo.cpp code assumes exactly 1 entry in the undo stack per entry in the replay. + // And doing so would create a second entry in the undo stack for this 'auto_shroud' entry. current_team.set_auto_shroud_updates(active); resources::undo_stack->add_auto_shroud(active); return true;