little cleaning of invalidations functions
This commit is contained in:
parent
4ffcbf3281
commit
6ed2269ff8
4 changed files with 43 additions and 36 deletions
|
@ -1056,17 +1056,6 @@ void display::highlight_hex(gamemap::location hex)
|
|||
invalidate(mouseoverHex_);
|
||||
}
|
||||
|
||||
bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
|
||||
{
|
||||
bool result = false;
|
||||
rect_of_hexes hexes = hexes_under_rect(rect);
|
||||
rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
|
||||
for (;i != end; ++i) {
|
||||
result |= invalidate(*i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void display::set_diagnostic(const std::string& msg)
|
||||
{
|
||||
if(diagnostic_label_ != 0) {
|
||||
|
@ -1739,14 +1728,6 @@ void display::bounds_check_position(int& xpos, int& ypos)
|
|||
}
|
||||
}
|
||||
|
||||
void display::invalidate_all()
|
||||
{
|
||||
DBG_DP << "invalidate_all()\n";
|
||||
invalidateAll_ = true;
|
||||
invalidated_.clear();
|
||||
update_rect(map_area());
|
||||
}
|
||||
|
||||
double display::turbo_speed() const
|
||||
{
|
||||
bool res = turbo_;
|
||||
|
@ -2134,8 +2115,41 @@ void display::refresh_report(reports::TYPE report_num, reports::report report,
|
|||
}
|
||||
}
|
||||
|
||||
void display::invalidate_all()
|
||||
{
|
||||
DBG_DP << "invalidate_all()\n";
|
||||
invalidateAll_ = true;
|
||||
invalidated_.clear();
|
||||
update_rect(map_area());
|
||||
}
|
||||
|
||||
bool display::invalidate(const gamemap::location& loc)
|
||||
{
|
||||
if(invalidateAll_)
|
||||
return false;
|
||||
|
||||
return invalidated_.insert(loc).second;
|
||||
}
|
||||
|
||||
bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
|
||||
{
|
||||
if(invalidateAll_)
|
||||
return false;
|
||||
|
||||
bool result = false;
|
||||
rect_of_hexes hexes = hexes_under_rect(rect);
|
||||
rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
|
||||
for (;i != end; ++i) {
|
||||
result |= invalidate(*i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool display::rectangle_need_update(const SDL_Rect& rect) const
|
||||
{
|
||||
if(invalidateAll_)
|
||||
return true;
|
||||
|
||||
rect_of_hexes hexes = hexes_under_rect(rect);
|
||||
rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
|
||||
for (;i != end; ++i) {
|
||||
|
|
|
@ -219,12 +219,20 @@ public:
|
|||
bool brightened = false);
|
||||
|
||||
// Will be overridden in the display subclass
|
||||
virtual bool invalidate(const gamemap::location& loc) {return invalidated_.insert(loc).second;};
|
||||
bool rectangle_need_update(const SDL_Rect& rect) const;
|
||||
virtual void draw_minimap_units() {};
|
||||
|
||||
//! Function to invalidate all tiles.
|
||||
void invalidate_all();
|
||||
|
||||
//! Function to invalidate a specific tile for redrawing.
|
||||
bool invalidate(const gamemap::location& loc);
|
||||
|
||||
//! invalidate all hexes under the rectangle rect (in screen coordinates)
|
||||
bool invalidate_locations_in_rect(const SDL_Rect& rect);
|
||||
|
||||
//! check if an hexes under the rectangle is invalidated
|
||||
bool rectangle_need_update(const SDL_Rect& rect) const;
|
||||
|
||||
/**
|
||||
* Function to invalidate animated terrains which may have changed.
|
||||
*/
|
||||
|
@ -326,9 +334,6 @@ public:
|
|||
void bounds_check_position();
|
||||
void bounds_check_position(int& xpos, int& ypos);
|
||||
|
||||
//! Function to invalidate all tiles.
|
||||
void invalidate_all();
|
||||
|
||||
//! Scrolls the display by xmov,ymov pixels.
|
||||
//! Invalidation and redrawing will be scheduled.
|
||||
void scroll(int xmov, int ymov);
|
||||
|
|
|
@ -888,15 +888,6 @@ const SDL_Rect& game_display::calculate_energy_bar(surface surf)
|
|||
return calculate_energy_bar(surf);
|
||||
}
|
||||
|
||||
bool game_display::invalidate(const gamemap::location& loc)
|
||||
{
|
||||
if(!invalidateAll_) {
|
||||
bool tmp = invalidated_.insert(loc).second;
|
||||
return tmp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void game_display::invalidate_animations_location(const gamemap::location& loc) {
|
||||
if (map_.is_village(loc)) {
|
||||
const int owner = player_teams::village_owner(loc);
|
||||
|
|
|
@ -103,9 +103,6 @@ public:
|
|||
//! Draws the movement info (turns available) for a given location.
|
||||
void draw_movement_info(const gamemap::location& loc);
|
||||
|
||||
//! Function to invalidate a specific tile for redrawing.
|
||||
bool invalidate(const gamemap::location& loc);
|
||||
|
||||
const gamestatus &get_game_status() { return status_; }
|
||||
void draw_report(reports::TYPE report_num);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue