Don't invalidate villages for flag animations, unless they are owned.

This commit is contained in:
Dominic Bolin 2006-08-10 17:39:52 +00:00
parent 7e62a1833a
commit cb3e6ffc55
3 changed files with 20 additions and 1 deletions

View file

@ -2060,7 +2060,7 @@ void display::invalidate_animations()
for(int x = topleft.x; x <= bottomright.x; ++x) {
for(int y = topleft.y; y <= bottomright.y; ++y) {
gamemap::location loc(x,y);
if(builder_.update_animation(loc) || (map_.is_village(loc) && animate_flags)) {
if(builder_.update_animation(loc) || (map_.is_village(loc) && animate_flags && player_teams::village_owner(loc) != -1)) {
invalidate(loc);
}
}

View file

@ -986,3 +986,18 @@ void team::log_recruitable(){
}
LOG_NG << "Added all recruitable units\n";
}
namespace player_teams {
int village_owner(const gamemap::location& loc)
{
if(! teams) {
return -1;
}
for(size_t i = 0; i != teams->size(); ++i) {
if((*teams)[i].owns_village(loc))
return i;
}
return -1;
}
}

View file

@ -276,6 +276,10 @@ struct teams_manager {
bool is_observer();
};
namespace player_teams {
int village_owner(const gamemap::location& loc);
}
bool is_observer();
//function which will validate a side. Trows game::game_error