Fixed a CVS-only problem with "Update Shroud Now" ...

....not calling clear_shroud_unit(...) properly.

This resulted in 1) Update Shroud possibly revealed more map area
because it ignored enemy units, and 2) Update Shroud possibly didn't
reveal enough shroud if a unit moved multiple times during its turn.
This commit is contained in:
John B. Messerly 2004-05-17 02:42:41 +00:00
parent 44997a452f
commit 7425f77765

View file

@ -1756,12 +1756,16 @@ void apply_shroud_changes(undo_list& undos, display* disp, const gamestatus& sta
*/
for(undo_list::const_iterator un = undos.begin(); un != undos.end(); ++un) {
if(un->is_recall()) continue;
unit_map um;
//we're not really going to mutate the unit, just temporarily
//set its moves to maximum, but then switch them back
const unit_movement_resetter move_resetter(const_cast<unit&>(un->affected_unit));
std::vector<gamemap::location>::const_iterator step;
for(step = un->route.begin(); step != un->route.end(); ++step) {
um.insert(std::pair<gamemap::location,unit>(*step,un->affected_unit));
clear_shroud_unit(map,status,gamedata,um,*step,teams,team,NULL,NULL);
um.erase(*step);
//we have to swap out any unit that is already in the hex, so we can put our
//unit there, then we'll swap back at the end.
const temporary_unit_placer unit_placer(const_cast<unit_map&>(units),*step,un->affected_unit);
clear_shroud_unit(map,status,gamedata,units,*step,teams,team,NULL,NULL);
}
}
if(disp != NULL) {