Fixed a shared vision bug.

We weren't invalidating map tiles if the shroud changed. Now we are.

The symptom was squares appearing "unshrouded" in the minimap, but not
on the game map until you hovered over them, or did something else
that forces a refresh.
This commit is contained in:
John B. Messerly 2004-05-13 02:19:39 +00:00
parent 47c8c39a7b
commit 0401be921d

View file

@ -577,8 +577,10 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
for(;;) {
config* const cfg = replayer.get_next_action();
config* child;
//do we need to recalculate shroud after this action is processed?
bool fix_shroud = false;
//if we are expecting promotions here
if(advancing_units.empty() == false) {
@ -674,8 +676,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
statistics::recruit_unit(new_unit);
current_team.spend_gold(u_type->second.cost());
if(clear_shroud(disp,state,map,gameinfo,units,teams,team_num-1))
disp.recalculate_minimap();
fix_shroud = true;
}
else if((child = cfg->child("recall")) != NULL) {
@ -697,8 +698,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
std::cerr << "illegal recall\n";
throw replay::error();
}
if(clear_shroud(disp,state,map,gameinfo,units,teams,team_num-1))
disp.recalculate_minimap();
fix_shroud = true;
}
else if((child = cfg->child("move")) != NULL) {
@ -777,8 +777,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
game_events::fire("sighted",dst);
}
if(clear_shroud(disp,state,map,gameinfo,units,teams,team_num-1))
disp.recalculate_minimap();
fix_shroud = true;
}
else if((child = cfg->child("attack")) != NULL) {
@ -844,13 +843,19 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
if(advancing_units.empty()) {
check_victory(units,teams);
}
if(clear_shroud(disp,state,map,gameinfo,units,teams,team_num-1))
disp.recalculate_minimap();
fix_shroud = true;
} else {
std::cerr << "unrecognized action: '" << cfg->write() << "'\n";
throw replay::error();
}
//Check if we should refresh the shroud, and redraw the minimap/map tiles.
//This is needed for shared vision to work properly.
if(fix_shroud && clear_shroud(disp,state,map,gameinfo,units,teams,team_num-1)) {
disp.recalculate_minimap();
disp.invalidate_all();
}
child = cfg->child("verify");
if(child != NULL) {
verify_units(*child);