When a leader dies the villages,

...which no longer are owned, are properly redrawn (bug #9136).
This commit is contained in:
Mark de Wever 2008-01-11 13:22:08 +00:00
parent 9ff36b1706
commit 4cbc84c441
7 changed files with 12 additions and 7 deletions

View file

@ -8,6 +8,8 @@ Version 1.3.13+svn:
* graphics:
* overlays are properly drawn at the top row (eg forrest) (bug #10238)
* mountains no longer have a hill as base
* when a leader dies the villages, which are no longer are owned, are
properly redrawn (bug #9136)
* language and i18n:
* updated translations: Chinese, Danish, Finnish, French, German, Italian,
Lithuanian, Slovak, Spanish

View file

@ -1681,7 +1681,7 @@ void advance_unit(const game_data& info,
game_events::fire("post_advance",loc);
}
void check_victory(unit_map& units, std::vector<team>& teams)
void check_victory(unit_map& units, std::vector<team>& teams, display& disp)
{
std::vector<int> seen_leaders;
for(unit_map::const_iterator i = units.begin();
@ -1696,6 +1696,9 @@ void check_victory(unit_map& units, std::vector<team>& teams)
for(std::vector<team>::iterator tm = teams.begin(); tm != teams.end(); ++tm) {
if(std::find(seen_leaders.begin(),seen_leaders.end(),tm-teams.begin() + 1) == seen_leaders.end()) {
tm->clear_villages();
// invalidate_all() is overkill and expensive but this code is
// run rarely so do it the expensive way.
disp.invalidate_all();
}
}

View file

@ -256,7 +256,7 @@ gamemap::location under_leadership(const unit_map& units,
//! Checks to see if a side has won, and will throw
//! an end_level_exception if one has.
//! Will also remove control of villages from sides with dead leaders.
void check_victory(unit_map& units, std::vector<team>& teams);
void check_victory(unit_map& units, std::vector<team>& teams, display& disp);
//! Gets the time of day at a certain tile.
//! Certain tiles may have a time of day that differs

View file

@ -1129,7 +1129,7 @@ void ai_interface::attack_enemy(const location u,
}
}
check_victory(info_.units,info_.teams);
check_victory(info_.units,info_.teams, info_.disp);
raise_enemy_attacked();
}
}

View file

@ -1425,7 +1425,7 @@ bool mouse_handler::attack_enemy_(unit_map::iterator attacker, unit_map::iterato
current_route_.steps.clear();
gui_->set_route(NULL);
check_victory(units_,teams_);
check_victory(units_, teams_, *gui_);
gui_->draw();

View file

@ -483,7 +483,7 @@ void playsingle_controller::play_turn(bool save)
}
finish_side_turn();
check_victory(units_,teams_);
check_victory(units_, teams_, *gui_);
}
// Time has run out

View file

@ -729,7 +729,7 @@ bool do_replay(game_display& disp, const gamemap& map, const game_data& gameinfo
//if there are no more advancing units, then we check for victory,
//in case the battle that led to advancement caused the end of scenario
if(advancing_units.empty()) {
check_victory(units,teams);
check_victory(units, teams, disp);
}
continue;
@ -1086,7 +1086,7 @@ bool do_replay(game_display& disp, const gamemap& map, const game_data& gameinfo
//check victory now if we don't have any advancements. If we do have advancements,
//we don't check until the advancements are processed.
if(advancing_units.empty()) {
check_victory(units,teams);
check_victory(units, teams, disp);
}
fix_shroud = !replayer.is_skipping();
} else if((child = cfg->child("fire_event")) != NULL) {