From d3681e41c85db0f1a8f2b86958cc249748879753 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 5 Jul 2017 21:42:01 +1100 Subject: [PATCH] Display: removed all the invalidated locations code This removes all the code related to invalidating locations, any functions used to set, modify, or propagate location invalidation, and several functions that no longer serve any purpose anymore since their only purpose was to handle invalidated locations. --- src/actions/advancement.cpp | 3 - src/actions/attack.cpp | 10 - src/actions/create.cpp | 1 - src/actions/move.cpp | 6 - src/actions/undo_recall_action.cpp | 5 +- src/actions/undo_recruit_action.cpp | 4 - src/actions/unit_creator.cpp | 11 +- src/actions/vision.cpp | 14 - src/arrow.cpp | 14 - src/arrow.hpp | 2 - src/display.cpp | 250 +----------------- src/display.hpp | 44 --- src/editor/action/mouse/mouse_action_item.cpp | 8 - src/editor/action/mouse/mouse_action_unit.cpp | 8 - src/editor/controller/editor_controller.cpp | 4 - src/editor/editor_display.cpp | 5 - src/editor/map/context_manager.cpp | 9 - src/fake_unit_manager.cpp | 2 - src/floating_textbox.cpp | 3 +- src/game_display.cpp | 44 --- src/game_display.hpp | 4 - src/gui/dialogs/editor/custom_tod.cpp | 3 - src/menu_events.cpp | 7 - src/play_controller.cpp | 11 - src/playsingle_controller.cpp | 1 - src/replay_controller.cpp | 2 - src/scripting/game_lua_kernel.cpp | 19 -- src/synced_commands.cpp | 2 +- src/units/animation.cpp | 4 +- src/units/udisplay.cpp | 22 -- src/whiteboard/attack.cpp | 21 -- src/whiteboard/attack.hpp | 8 - src/whiteboard/manager.cpp | 2 - src/whiteboard/move.cpp | 2 - src/whiteboard/recall.cpp | 5 - src/whiteboard/recall.hpp | 2 - src/whiteboard/recruit.cpp | 6 - src/whiteboard/recruit.hpp | 2 - src/whiteboard/side_actions.cpp | 15 -- src/whiteboard/suppose_dead.cpp | 12 - src/whiteboard/suppose_dead.hpp | 3 - src/whiteboard/utility.cpp | 2 - 42 files changed, 9 insertions(+), 593 deletions(-) diff --git a/src/actions/advancement.cpp b/src/actions/advancement.cpp index e8d06536f2a6..32988f05e3b6 100644 --- a/src/actions/advancement.cpp +++ b/src/actions/advancement.cpp @@ -142,12 +142,9 @@ namespace animator.start_animations(); animator.wait_for_end(); animator.set_all_standing(); - display::get_singleton()->invalidate(loc); events::pump(); } - display::get_singleton()->invalidate_all(); - return true; } diff --git a/src/actions/attack.cpp b/src/actions/attack.cpp index d8540170dbef..3837ff5f6459 100644 --- a/src/actions/attack.cpp +++ b/src/actions/attack.cpp @@ -1248,7 +1248,6 @@ void attack::unit_killed(unit_info& attacker, attacker.xp_ = game_config::kill_xp(defender.get_unit().level()); defender.xp_ = 0; - display::get_singleton()->invalidate(attacker.loc_); game_events::entity_location death_loc(defender.loc_, defender.id_); game_events::entity_location attacker_loc(attacker.loc_, attacker.id_); @@ -1340,10 +1339,6 @@ void attack::unit_killed(unit_info& attacker, resources::game_events->pump().fire("unit_placed", reanim_loc); preferences::encountered_units().insert(newunit->type_id()); - - if(update_display_) { - display::get_singleton()->invalidate(death_loc); - } } } else { LOG_NG << "unit not reanimated\n"; @@ -1492,11 +1487,6 @@ void attack::perform() unit_display::unit_sheath_weapon(a_.loc_, a_.valid() ? &a_.get_unit() : nullptr, a_stats_->weapon, d_stats_->weapon, d_.loc_, d_.valid() ? &d_.get_unit() : nullptr); - if(update_display_) { - game_display::get_singleton()->invalidate_unit(); - display::get_singleton()->invalidate(a_.loc_); - display::get_singleton()->invalidate(d_.loc_); - } if(OOS_error_) { replay::process_error(errbuf_.str()); diff --git a/src/actions/create.cpp b/src/actions/create.cpp index 087ee5836ead..ef48be8e727b 100644 --- a/src/actions/create.cpp +++ b/src/actions/create.cpp @@ -668,7 +668,6 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat // Make sure the unit appears (if either !show or the animation is suppressed). new_unit_itor->set_hidden(false); if (display::get_singleton() != nullptr ) { - display::get_singleton()->invalidate(current_loc); display::get_singleton()->redraw_minimap(); } diff --git a/src/actions/move.cpp b/src/actions/move.cpp index ec13add2b233..1f98ec9efafe 100644 --- a/src/actions/move.cpp +++ b/src/actions/move.cpp @@ -174,9 +174,6 @@ game_events::pump_result_t get_village(const map_location& loc, int side, bool * } if(not_defeated) { - if (display::get_singleton() != nullptr) { - display::get_singleton()->invalidate(loc); - } return t->get_village(loc, old_owner_side, fire_event ? resources::gamedata : nullptr); } @@ -537,7 +534,6 @@ namespace { // Private helpers for move_unit() // but it works. move_it_->anim_comp().set_standing(false); disp.invalidate_unit_after_move(*move_loc_, *step_to); - disp.invalidate(*step_to); move_loc_ = step_to; // Show this move. @@ -903,8 +899,6 @@ namespace { // Private helpers for move_unit() } } - // Make sure this hex is drawn correctly. - disp.invalidate(hex); // Fire sighted events. bool wml_undo_blocked = false; diff --git a/src/actions/undo_recall_action.cpp b/src/actions/undo_recall_action.cpp index c1ffad4adb4b..2201dc46c0bc 100644 --- a/src/actions/undo_recall_action.cpp +++ b/src/actions/undo_recall_action.cpp @@ -67,7 +67,6 @@ void recall_action::write(config & cfg) const */ bool recall_action::undo(int side) { - game_display & gui = *game_display::get_singleton(); unit_map & units = resources::gameboard->units(); team ¤t_team = resources::gameboard->get_team(side); @@ -92,9 +91,7 @@ bool recall_action::undo(int side) } current_team.recall_list().add(un); - // invalidate before erasing allow us - // to also do the overlapped hexes - gui.invalidate(recall_loc); + units.erase(recall_loc); this->return_village(); execute_undo_umc_wml(); diff --git a/src/actions/undo_recruit_action.cpp b/src/actions/undo_recruit_action.cpp index 780e56094ff1..49015919172f 100644 --- a/src/actions/undo_recruit_action.cpp +++ b/src/actions/undo_recruit_action.cpp @@ -68,7 +68,6 @@ void recruit_action::write(config & cfg) const */ bool recruit_action::undo(int side) { - game_display & gui = *game_display::get_singleton(); unit_map & units = resources::gameboard->units(); team ¤t_team = resources::gameboard->get_team(side); @@ -85,9 +84,6 @@ bool recruit_action::undo(int side) //MP_COUNTDOWN take away recruit bonus current_team.set_action_bonus_count(current_team.action_bonus_count() - 1); - // invalidate before erasing allow us - // to also do the overlapped hexes - gui.invalidate(recruit_loc); units.erase(recruit_loc); this->return_village(); execute_undo_umc_wml(); diff --git a/src/actions/unit_creator.cpp b/src/actions/unit_creator.cpp index 87694cd04b35..a99aea4fbfb4 100644 --- a/src/actions/unit_creator.cpp +++ b/src/actions/unit_creator.cpp @@ -236,14 +236,7 @@ void unit_creator::post_create(const map_location &loc, const unit &new_unit, bo resources::game_events->pump().fire("unit_placed", loc); } - if (display::get_singleton()!=nullptr) { - - if (invalidate_ ) { - display::get_singleton()->invalidate(loc); - } - - if (animate) { - unit_display::unit_recruited(loc); - } + if (animate) { + unit_display::unit_recruited(loc); } } diff --git a/src/actions/vision.cpp b/src/actions/vision.cpp index 15dafcfca72e..47cf6f7ec8c3 100644 --- a/src/actions/vision.cpp +++ b/src/actions/vision.cpp @@ -270,17 +270,6 @@ bool shroud_clearer::clear_loc(team &tm, const map_location &loc, } } - // Possible screen invalidation. - if ( was_fogged ) { - display::get_singleton()->invalidate(loc); - // Need to also invalidate adjacent hexes to get rid of the - // "fog edge" graphics. - adjacent_loc_array_t adjacent; - get_adjacent_tiles(loc, adjacent.data()); - for (unsigned i = 0; i < adjacent.size(); ++i ) - display::get_singleton()->invalidate(adjacent[i]); - } - // Check for units? if ( result && check_units && loc != event_non_loc ) { // Uncovered a unit? @@ -719,9 +708,6 @@ void recalculate_fog(int side) } tm.refog(); - // Invalidate the screen before clearing the shroud. - // This speeds up the invalidations within clear_shroud_unit(). - display::get_singleton()->invalidate_all(); shroud_clearer clearer; for (const unit &u : resources::gameboard->units()) diff --git a/src/arrow.cpp b/src/arrow.cpp index 9f464330109b..96ee6a6cace8 100644 --- a/src/arrow.cpp +++ b/src/arrow.cpp @@ -53,7 +53,6 @@ void arrow::hide() hidden_ = true; if(display* disp = display::get_singleton()) { - invalidate_arrow_path(path_); disp->remove_arrow(*this); } } @@ -78,7 +77,6 @@ void arrow::set_path(const arrow_path_t& path) update_symbols(); if(!hidden_) { - invalidate_arrow_path(previous_path_); notify_arrow_changed(); } } @@ -86,8 +84,6 @@ void arrow::set_path(const arrow_path_t& path) void arrow::reset() { - invalidate_arrow_path(previous_path_); - invalidate_arrow_path(path_); previous_path_.clear(); path_.clear(); symbols_map_.clear(); @@ -163,7 +159,6 @@ void arrow::update_symbols() } symbols_map_.clear(); - invalidate_arrow_path(path_); const std::string mods = "~RC(FF00FF>"+ color_ + ")"; //magenta to current color @@ -284,15 +279,6 @@ void arrow::update_symbols() } } -void arrow::invalidate_arrow_path(const arrow_path_t& path) -{ - if(display* disp = display::get_singleton()) { - for(const map_location& loc : path) { - disp->invalidate(loc); - } - } -} - void arrow::notify_arrow_changed() { if(display* disp = display::get_singleton()) { diff --git a/src/arrow.hpp b/src/arrow.hpp index 6c94fcbb9f56..c1cc2244d3d8 100644 --- a/src/arrow.hpp +++ b/src/arrow.hpp @@ -77,8 +77,6 @@ class arrow { /// Checks that the path is not of length 0 or 1 static bool valid_path(const arrow_path_t& path); - /// Invalidates every hex along the given path - static void invalidate_arrow_path(const arrow_path_t& path); virtual void notify_arrow_changed(); diff --git a/src/display.cpp b/src/display.cpp index 65d5d0be3f24..c0f444d90930 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -86,24 +86,6 @@ namespace { unsigned int display::zoom_ = DefaultZoom; unsigned int display::last_zoom_ = SmallZoom; -void display::parse_team_overlays() -{ - const team& curr_team = dc_->teams()[playing_team()]; - const team& prev_team = playing_team() == 0 - ? dc_->teams().back() - : dc_->get_team(playing_team()); - for (const game_display::overlay_map::value_type i : *overlays_) { - const overlay& ov = i.second; - if (!ov.team_name.empty() && - ((ov.team_name.find(curr_team.team_name()) + 1) != 0) != - ((ov.team_name.find(prev_team.team_name()) + 1) != 0)) - { - invalidate(i.first); - } - } -} - - void display::add_overlay(const map_location& loc, const std::string& img, const std::string& halo, const std::string& team_name, const std::string& item_id, bool visible_under_fog) { if (halo_man_) { @@ -173,7 +155,6 @@ display::display(const display_context * dc, std::weak_ptr wb, repo , minimap_location_(sdl::empty_rect) , redrawMinimap_(false) , redraw_background_(true) - , invalidateAll_(true) , grid_(false) , diagnostic_label_(0) , panelsDrawn_(false) @@ -193,7 +174,6 @@ display::display(const display_context * dc, std::weak_ptr wb, repo , reports_() , menu_buttons_() , action_buttons_() - , invalidated_() , mouseover_hex_overlay_(nullptr) , tod_hex_mask1(nullptr) , tod_hex_mask2(nullptr) @@ -213,7 +193,6 @@ display::display(const display_context * dc, std::weak_ptr wb, repo , reach_map_changed_(true) , overlays_(nullptr) , fps_handle_(0) - , invalidated_hexes_(0) , drawn_hexes_(0) , idle_anim_(preferences::idle_anim()) , idle_anim_rate_(1.0) @@ -261,10 +240,6 @@ display::display(const display_context * dc, std::weak_ptr wb, repo rebuild_all(); assert(builder_); //builder_->rebuild_cache_all(); - invalidate_all(); - - //invalidate_locations_in_rect(map_area()); - } display::~display() @@ -812,7 +787,6 @@ bool display::screenshot(const std::string& filename, bool map_screenshot) // we reroute render output to the screenshot surface and invalidate all map_screenshot_= true ; - invalidateAll_ = true; DBG_DP << "draw() with map_screenshot\n"; draw(true,true); @@ -1272,14 +1246,9 @@ void display::draw_debugging_aids() stream << "Time: " << std::setfill(' ') << std::setw(3) << *minmax_it.first << '/' << std::setw(3) << render_avg << '/' << std::setw(3) << *minmax_it.second << " ms\n"; if(game_config::debug) { stream << "\nhex: " << drawn_hexes_ * 1.0 / sample_freq; - - if(drawn_hexes_ != invalidated_hexes_) { - stream << " (" << (invalidated_hexes_ - drawn_hexes_) * 1.0 / sample_freq << ")"; - } } drawn_hexes_ = 0; - invalidated_hexes_ = 0; font::floating_label flabel(stream.str()); flabel.set_font_size(12); @@ -1293,7 +1262,6 @@ void display::draw_debugging_aids() font::remove_floating_label(fps_handle_); fps_handle_ = 0; drawn_hexes_ = 0; - invalidated_hexes_ = 0; } } @@ -1421,17 +1389,13 @@ void display::draw_text_in_hex(const map_location& loc, void display::select_hex(map_location hex) { - invalidate(selectedHex_); selectedHex_ = hex; - invalidate(selectedHex_); recalculate_minimap(); } void display::highlight_hex(map_location hex) { - invalidate(mouseoverHex_); mouseoverHex_ = hex; - invalidate(mouseoverHex_); } void display::set_diagnostic(const std::string& msg) @@ -1461,10 +1425,6 @@ void display::draw_init() return; } - if(benchmark) { - invalidateAll_ = true; - } - if(!panelsDrawn_) { draw_all_panels(); panelsDrawn_ = true; @@ -1478,19 +1438,6 @@ void display::draw_init() SDL_FillRect(screen, &clip_rect, 0x00000000); draw_background(clip_rect, theme_.border().background_image); redraw_background_ = false; - - // Force a full map redraw - invalidateAll_ = true; - } - - if(invalidateAll_) { - DBG_DP << "draw() with invalidateAll\n"; - - // toggle invalidateAll_ first to allow regular invalidations - invalidateAll_ = false; - invalidate_locations_in_rect(map_area()); - - redrawMinimap_ = true; } } @@ -1864,7 +1811,6 @@ bool display::set_zoom(unsigned int amount, const bool validate_value_and_set_in labels().recalculate_labels(); redraw_background_ = true; - invalidate_all(); // Forces a redraw after zooming. // This prevents some graphic glitches from occurring. @@ -2470,100 +2416,6 @@ void display::refresh_report(const std::string& report_name, const config * new_ } } -void display::invalidate_all() -{ - DBG_DP << "invalidate_all()\n"; - invalidateAll_ = true; -#ifdef _OPENMP -#pragma omp critical(invalidated_) -#endif //_OPENMP - invalidated_.clear(); -} - -bool display::invalidate(const map_location& loc) -{ - if(invalidateAll_) - return false; - - bool tmp; -#ifdef _OPENMP -#pragma omp critical(invalidated_) -#endif //_OPENMP - tmp = invalidated_.insert(loc).second; - return tmp; -} - -bool display::invalidate(const std::set& locs) -{ - if(invalidateAll_) - return false; - bool ret = false; - for (const map_location& loc : locs) { -#ifdef _OPENMP -#pragma omp critical(invalidated_) -#endif //_OPENMP - ret = invalidated_.insert(loc).second || ret; - } - return ret; -} - -bool display::propagate_invalidation(const std::set& locs) -{ - if(invalidateAll_) - return false; - - if(locs.size()<=1) - return false; // propagation never needed - - bool result = false; -#ifdef _OPENMP -#pragma omp critical(invalidated_) -#endif //_OPENMP - { - // search the first hex invalidated (if any) - std::set::const_iterator i = locs.begin(); - for(; i != locs.end() && invalidated_.count(*i) == 0 ; ++i) {} - - if (i != locs.end()) { - - // propagate invalidation - // 'i' is already in, but I suspect that splitting the range is bad - // especially because locs are often adjacents - size_t previous_size = invalidated_.size(); - invalidated_.insert(locs.begin(), locs.end()); - result = previous_size < invalidated_.size(); - } - } - return result; -} - -bool display::invalidate_visible_locations_in_rect(const SDL_Rect& rect) -{ - return invalidate_locations_in_rect(sdl::intersect_rects(map_area(),rect)); -} - -bool display::invalidate_locations_in_rect(const SDL_Rect& rect) -{ - if(invalidateAll_) - return false; - - bool result = false; - for (const map_location &loc : hexes_under_rect(rect)) { - result |= invalidate(loc); - } - return result; -} - -void display::invalidate_animations_location(const map_location& loc) { - if (get_map().is_village(loc)) { - const int owner = dc_->village_owner(loc); - if (owner >= 0 && flags_[owner].need_update() - && (!fogged(loc) || !dc_->teams()[currentTeam_].is_enemy(owner+1))) { - invalidate(loc); - } - } -} - void display::invalidate_animations() { new_animation_frame(); @@ -2575,11 +2427,7 @@ void display::invalidate_animations() continue; } - if(builder_->update_animation(loc)) { - invalidate(loc); - } else { - invalidate_animations_location(loc); - } + builder_->update_animation(loc); } } @@ -2698,46 +2546,6 @@ void display::read(const config& cfg) color_adjust_.b = cfg["color_adjust_blue"].to_int(0); } -void display::process_reachmap_changes() -{ - if (!reach_map_changed_) return; - if (reach_map_.empty() != reach_map_old_.empty()) { - // Invalidate everything except the non-darkened tiles - reach_map &full = reach_map_.empty() ? reach_map_old_ : reach_map_; - - for (const auto& hex : get_visible_hexes()) { - reach_map::iterator reach = full.find(hex); - if (reach == full.end()) { - // Location needs to be darkened or brightened - invalidate(hex); - } else if (reach->second != 1) { - // Number needs to be displayed or cleared - invalidate(hex); - } - } - } else if (!reach_map_.empty()) { - // Invalidate only changes - reach_map::iterator reach, reach_old; - for (reach = reach_map_.begin(); reach != reach_map_.end(); ++reach) { - reach_old = reach_map_old_.find(reach->first); - if (reach_old == reach_map_old_.end()) { - invalidate(reach->first); - } else { - if (reach_old->second != reach->second) { - invalidate(reach->first); - } - reach_map_old_.erase(reach_old); - } - } - for (reach_old = reach_map_old_.begin(); reach_old != reach_map_old_.end(); ++reach_old) { - invalidate(reach_old->first); - } - } - reach_map_old_ = reach_map_; - reach_map_changed_ = false; -} - - /* Debugging aid to slow things down a bit. Don't ever enable this in a release! */ #ifdef SLOW_THINGS_DOWN #undef SLOW_THINGS_DOWN @@ -2791,8 +2599,7 @@ void display::draw(bool update, bool force) // save it as the previous invalidated, and merge with the previous invalidated_ // we merge with the previous redraw because if a hex had a unit last redraw but // not this one, nobody will tell us to redraw (cleanup) - previous_invalidated_.swap(invalidated_); - invalidated_.insert(previous_invalidated_.begin(),previous_invalidated_.end()); + // these new invalidations cannot cause any propagation because // if a hex was invalidated last turn but not this turn, then // * case of no unit in neighbor hex=> no propagation @@ -2802,19 +2609,6 @@ void display::draw(bool update, bool force) #ifdef SLOW_THINGS_DOWN int simulate_delay = 0; #endif - - /* - * draw_invalidated() also invalidates the halos, so also needs to be - * ran if invalidated_.empty() == true. - */ - //drawing_queue_.set_clip_rect(map_area()); - if(!invalidated_.empty() || preferences::show_haloes()) { - draw_invalidated(); - invalidated_.clear(); - } - - //drawing_queue_.render_buffer(); - post_commit(); draw_sidebar(); @@ -2871,7 +2665,7 @@ void display::redraw_everything() } int ticks1 = SDL_GetTicks(); - invalidate_all(); + //invalidate_all(); int ticks2 = SDL_GetTicks(); draw(true,true); int ticks3 = SDL_GetTicks(); @@ -2881,44 +2675,6 @@ void display::redraw_everything() } -void display::draw_invalidated() { - return; -// log_scope("display::draw_invalidated"); - SDL_Rect clip_rect = get_clip_rect(); - surface& screen = get_screen_surface(); - clip_rect_setter set_clip_rect(screen, &clip_rect); - for (const map_location& loc : get_visible_hexes()) { - int xpos = get_location_x(loc); - int ypos = get_location_y(loc); - - //const bool on_map = get_map().on_board(loc); - SDL_Rect hex_rect = sdl::create_rect(xpos, ypos, zoom_, zoom_); - if(!sdl::rects_overlap(hex_rect,clip_rect)) { - continue; - } - draw_hex(loc); - drawn_hexes_+=1; - } - invalidated_hexes_ += invalidated_.size(); - - if (dc_->teams().empty()) - { - // The unit drawer can't function without teams - return; - } - - unit_drawer drawer = unit_drawer(*this); - - for (const map_location& loc : invalidated_) { - unit_map::const_iterator u_it = dc_->units().find(loc); - exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc); - if (u_it != dc_->units().end() - && (request == exclusive_unit_draw_requests_.end() || request->second == u_it->id())) - drawer.redraw_unit(*u_it); - } -} - - // // NEW RENDERING CODE ========================================================================= // diff --git a/src/display.hpp b/src/display.hpp index a2aca5bdce1a..12256c60865b 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -135,12 +135,6 @@ class display : public video2::draw_layering */ std::string remove_exclusive_draw(const map_location& loc); - /** - * Check the overlay_map for proper team-specific overlays to be - * displayed/hidden - */ - void parse_team_overlays(); - /** * Functions to add and remove overlays from locations. * @@ -408,37 +402,11 @@ class display : public video2::draw_layering void draw_minimap_units(); - /** Function to invalidate all tiles. */ - void invalidate_all(); - - /** Function to invalidate a specific tile for redrawing. */ - bool invalidate(const map_location& loc); - - bool invalidate(const std::set& locs); - - /** - * If this set is partially invalidated, invalidate all its hexes. - * Returns if any new invalidation was needed - */ - bool propagate_invalidation(const std::set& locs); - - /** invalidate all hexes under the rectangle rect (in screen coordinates) */ - bool invalidate_locations_in_rect(const SDL_Rect& rect); - bool invalidate_visible_locations_in_rect(const SDL_Rect& rect); - /** * Function to invalidate animated terrains and units which may have changed. */ void invalidate_animations(); - /** - * Per-location invalidation called by invalidate_animations() - * Extra game per-location invalidation (village ownership) - */ - void invalidate_animations_location(const map_location& loc); - - void reset_standing_animations(); - /** * mouseover_hex_overlay_ require a prerendered surface * and is drawn underneath the mouse's location @@ -713,14 +681,6 @@ class display : public video2::draw_layering */ virtual const SDL_Rect& get_clip_rect(); - /** - * Only called when there's actual redrawing to do. Loops through - * invalidated locations and redraws them. Derived classes can override - * this, possibly to insert pre- or post-processing around a call to the - * base class's function. - */ - virtual void draw_invalidated(); - /** * Hook for actions to take right after draw() renders the drawing buffer. * No action here by default. @@ -778,7 +738,6 @@ class display : public video2::draw_layering SDL_Rect minimap_location_; bool redrawMinimap_; bool redraw_background_; - bool invalidateAll_; bool grid_; int diagnostic_label_; bool panelsDrawn_; @@ -808,7 +767,6 @@ class display : public video2::draw_layering std::map reportSurfaces_; std::map reports_; std::vector> menu_buttons_, action_buttons_; - std::set invalidated_; surface mouseover_hex_overlay_; // If we're transitioning from one time of day to the next, // then we will use these two masks on top of all hexes when we blit. @@ -915,7 +873,6 @@ class display : public video2::draw_layering reach_map reach_map_; reach_map reach_map_old_; bool reach_map_changed_; - void process_reachmap_changes(); typedef std::multimap overlay_map; @@ -927,7 +884,6 @@ class display : public video2::draw_layering /** Handle for the label which displays frames per second. */ int fps_handle_; /** Count work done for the debug info displayed under fps */ - int invalidated_hexes_; int drawn_hexes_; bool idle_anim_; diff --git a/src/editor/action/mouse/mouse_action_item.cpp b/src/editor/action/mouse/mouse_action_item.cpp index beae333912b0..a5669094f860 100644 --- a/src/editor/action/mouse/mouse_action_item.cpp +++ b/src/editor/action/mouse/mouse_action_item.cpp @@ -33,14 +33,6 @@ void mouse_action_item::move(editor_display& disp, const map_location& hex) update_brush_highlights(disp, hex); - std::set adjacent_set; - adjacent_loc_array_t adjacent; - get_adjacent_tiles(previous_move_hex_, adjacent.data()); - - for (unsigned i = 0; i < adjacent.size(); i++) - adjacent_set.insert(adjacent[i]); - - disp.invalidate(adjacent_set); previous_move_hex_ = hex; // const item_map& items = disp.get_items(); diff --git a/src/editor/action/mouse/mouse_action_unit.cpp b/src/editor/action/mouse/mouse_action_unit.cpp index 4f73efbeed7e..695cfcd47091 100644 --- a/src/editor/action/mouse/mouse_action_unit.cpp +++ b/src/editor/action/mouse/mouse_action_unit.cpp @@ -37,14 +37,6 @@ void mouse_action_unit::move(editor_display& disp, const map_location& hex) update_brush_highlights(disp, hex); - std::set adjacent_set; - adjacent_loc_array_t adjacent; - get_adjacent_tiles(previous_move_hex_, adjacent.data()); - - for (unsigned i = 0; i < adjacent.size(); i++) - adjacent_set.insert(adjacent[i]); - - disp.invalidate(adjacent_set); previous_move_hex_ = hex; const unit_map& units = disp.get_units(); diff --git a/src/editor/controller/editor_controller.cpp b/src/editor/controller/editor_controller.cpp index 92573b3835c2..dc8ba7887b35 100644 --- a/src/editor/controller/editor_controller.cpp +++ b/src/editor/controller/editor_controller.cpp @@ -966,17 +966,14 @@ bool editor_controller::do_execute_command(const hotkey::hotkey_command& cmd, in case HOTKEY_EDITOR_DRAW_COORDINATES: gui().set_draw_coordinates(!gui().get_draw_coordinates()); preferences::editor::set_draw_hex_coordinates(gui().get_draw_coordinates()); - gui().invalidate_all(); return true; case HOTKEY_EDITOR_DRAW_TERRAIN_CODES: gui().set_draw_terrain_codes(!gui().get_draw_terrain_codes()); preferences::editor::set_draw_terrain_codes(gui().get_draw_terrain_codes()); - gui().invalidate_all(); return true; case HOTKEY_EDITOR_DRAW_NUM_OF_BITMAPS: gui().set_draw_num_of_bitmaps(!gui().get_draw_num_of_bitmaps()); preferences::editor::set_draw_num_of_bitmaps(gui().get_draw_num_of_bitmaps()); - gui().invalidate_all(); return true; case HOTKEY_EDITOR_REMOVE_LOCATION: { location_palette* lp = dynamic_cast(&toolkit_->get_palette_manager()->active_palette()); @@ -1108,7 +1105,6 @@ void editor_controller::preferences() void editor_controller::toggle_grid() { preferences::set_grid(!preferences::grid()); - gui_->invalidate_all(); } void editor_controller::unit_description() diff --git a/src/editor/editor_display.cpp b/src/editor/editor_display.cpp index d3dc97a25816..7cdda5e5451f 100644 --- a/src/editor/editor_display.cpp +++ b/src/editor/editor_display.cpp @@ -42,26 +42,21 @@ editor_display::editor_display(editor_controller& controller, reports& reports_o void editor_display::add_brush_loc(const map_location& hex) { brush_locations_.insert(hex); - invalidate(hex); } void editor_display::set_brush_locs(const std::set& hexes) { - invalidate(brush_locations_); brush_locations_ = hexes; - invalidate(brush_locations_); } void editor_display::clear_brush_locs() { - invalidate(brush_locations_); brush_locations_.clear(); } void editor_display::remove_brush_loc(const map_location& hex) { brush_locations_.erase(hex); - invalidate(hex); } void editor_display::rebuild_terrain(const map_location &loc) { diff --git a/src/editor/map/context_manager.cpp b/src/editor/map/context_manager.cpp index a1effb5f78a2..6c347d05bf3f 100644 --- a/src/editor/map/context_manager.cpp +++ b/src/editor/map/context_manager.cpp @@ -118,7 +118,6 @@ void context_manager::refresh_all() gui_.rebuild_all(); get_map_context().set_needs_terrain_rebuild(false); gui_.create_buttons(); - gui_.invalidate_all(); get_map_context().clear_changed_locations(); gui_.recalculate_minimap(); } @@ -527,18 +526,10 @@ void context_manager::refresh_after_action(bool drag_part) { gui_.rebuild_all(); get_map_context().set_needs_terrain_rebuild(false); - gui_.invalidate_all(); } else { for(const map_location& loc : changed_locs) { gui_.rebuild_terrain(loc); } - gui_.invalidate(changed_locs); - } - } else { - if(get_map_context().everything_changed()) { - gui_.invalidate_all(); - } else { - gui_.invalidate(changed_locs); } } diff --git a/src/fake_unit_manager.cpp b/src/fake_unit_manager.cpp index 1fa2c45192a0..da6494965aea 100644 --- a/src/fake_unit_manager.cpp +++ b/src/fake_unit_manager.cpp @@ -34,7 +34,6 @@ void fake_unit_manager::place_temporary_unit(internal_ptr_type u) ERR_NG << "In fake_unit_manager::place_temporary_unit: attempt to add duplicate fake unit." << std::endl; } else { fake_units_.push_back(u); - my_display_.invalidate(u->get_location()); } } @@ -50,7 +49,6 @@ int fake_unit_manager::remove_temporary_unit(internal_ptr_type u) removed = std::distance(it, fake_units_.end()); //std::remove doesn't remove anything without using erase afterwards. fake_units_.erase(it, fake_units_.end()); - my_display_.invalidate(u->get_location()); // Redraw with no location to get rid of haloes u->anim_comp().clear_haloes(); } diff --git a/src/floating_textbox.cpp b/src/floating_textbox.cpp index 900c6025f7b0..a302533af570 100644 --- a/src/floating_textbox.cpp +++ b/src/floating_textbox.cpp @@ -36,7 +36,7 @@ namespace gui{ label_(0) {} - void floating_textbox::close(game_display& gui) + void floating_textbox::close(game_display& /*gui*/) { if(!active()) { return; @@ -50,7 +50,6 @@ namespace gui{ check_.reset(nullptr); font::remove_floating_label(label_); mode_ = TEXTBOX_NONE; - gui.invalidate_all(); } void floating_textbox::update_location(game_display& gui) diff --git a/src/game_display.cpp b/src/game_display.cpp index 4635c520de71..9bddabab4df9 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -125,7 +125,6 @@ void game_display::new_turn() tod_hex_mask2.assign(new_mask); } - invalidate_all(); const int cur_ticks = SDL_GetTicks(); const int wanted_ticks = starting_ticks + i*frame_time; @@ -143,7 +142,6 @@ void game_display::new_turn() display::update_tod(); - invalidate_all(); } void game_display::select_hex(map_location hex) @@ -217,8 +215,6 @@ void game_display::pre_draw() w->pre_draw(); } - process_reachmap_changes(); - /** * @todo FIXME: must modify changed, but best to do it at the * floating_label level @@ -233,25 +229,6 @@ void game_display::post_draw() } } -void game_display::draw_invalidated() -{ - return; // DONE - - display::draw_invalidated(); - if (fake_unit_man_->empty()) { - return; - } - unit_drawer drawer = unit_drawer(*this); - - for (const unit* temp_unit : *fake_unit_man_) { - const map_location& loc = temp_unit->get_location(); - exclusive_unit_draw_requests_t::iterator request = exclusive_unit_draw_requests_.find(loc); - if (invalidated_.find(loc) != invalidated_.end() - && (request == exclusive_unit_draw_requests_.end() || request->second == temp_unit->id())) - drawer.redraw_unit(*temp_unit); - } -} - void game_display::post_commit() { halo_man_->render(); @@ -459,7 +436,6 @@ void game_display::set_game_mode(const game_mode mode) { if(mode != mode_) { mode_ = mode; - invalidate_all(); } } @@ -645,26 +621,14 @@ bool game_display::unhighlight_reach() } } -void game_display::invalidate_route() -{ - for(std::vector::const_iterator i = route_.steps.begin(); - i != route_.steps.end(); ++i) { - invalidate(*i); - } -} - void game_display::set_route(const pathfind::marked_route *route) { - invalidate_route(); - if(route != nullptr) { route_ = *route; } else { route_.steps.clear(); route_.marks.clear(); } - - invalidate_route(); } void game_display::float_label(const map_location& loc, const std::string& text, const color_t& color) @@ -693,14 +657,8 @@ int& game_display::debug_highlight(const map_location& loc) void game_display::set_attack_indicator(const map_location& src, const map_location& dst) { if (attack_indicator_src_ != src || attack_indicator_dst_ != dst) { - invalidate(attack_indicator_src_); - invalidate(attack_indicator_dst_); - attack_indicator_src_ = src; attack_indicator_dst_ = dst; - - invalidate(attack_indicator_src_); - invalidate(attack_indicator_dst_); } } @@ -722,7 +680,6 @@ void game_display::begin_game() { in_game_ = true; create_buttons(); - invalidate_all(); } void game_display::needs_rebuild(bool b) { @@ -735,7 +692,6 @@ bool game_display::maybe_rebuild() { if (needs_rebuild_) { needs_rebuild_ = false; recalculate_minimap(); - invalidate_all(); rebuild_all(); return true; } diff --git a/src/game_display.hpp b/src/game_display.hpp index e679c5b9a8c0..b9833ed2dd70 100644 --- a/src/game_display.hpp +++ b/src/game_display.hpp @@ -136,8 +136,6 @@ class game_display : public display */ virtual void post_draw() override; - virtual void draw_invalidated() override; - virtual void post_commit() override; virtual void draw_hex(const map_location& loc) override; @@ -216,8 +214,6 @@ class game_display : public display pathfind::marked_route route_; - void invalidate_route(); - map_location displayedUnitHex_; double sidebarScaling_; diff --git a/src/gui/dialogs/editor/custom_tod.cpp b/src/gui/dialogs/editor/custom_tod.cpp index d60d4959e6c1..084426dcfaeb 100644 --- a/src/gui/dialogs/editor/custom_tod.cpp +++ b/src/gui/dialogs/editor/custom_tod.cpp @@ -291,9 +291,6 @@ void custom_tod::update_tod_display() disp->update_tod(&get_selected_tod()); - // invalidate all tiles so they are redrawn with the new ToD tint next - disp->invalidate_all(); - // redraw tiles disp->draw(false); } diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 4814e2782b1a..69895921e228 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -963,13 +963,11 @@ void menu_handler::execute_gotos(mouse_handler& mousehandler, int side) void menu_handler::toggle_ellipses() { preferences::set_ellipses(!preferences::ellipses()); - gui_->invalidate_all(); } void menu_handler::toggle_grid() { preferences::set_grid(!preferences::grid()); - gui_->invalidate_all(); } void menu_handler::unit_hold_position(mouse_handler& mousehandler, int side_num) @@ -977,7 +975,6 @@ void menu_handler::unit_hold_position(mouse_handler& mousehandler, int side_num) const unit_map::iterator un = units().find(mousehandler.get_selected_hex()); if(un != units().end() && un->side() == side_num && un->movement_left() >= 0) { un->toggle_hold_position(); - gui_->invalidate(mousehandler.get_selected_hex()); mousehandler.set_current_paths(pathfind::paths()); @@ -992,7 +989,6 @@ void menu_handler::end_unit_turn(mouse_handler& mousehandler, int side_num) const unit_map::iterator un = units().find(mousehandler.get_selected_hex()); if(un != units().end() && un->side() == side_num && un->movement_left() >= 0) { un->toggle_user_end_turn(); - gui_->invalidate(mousehandler.get_selected_hex()); mousehandler.set_current_paths(pathfind::paths()); @@ -1927,18 +1923,15 @@ void console_handler::do_event() void console_handler::do_toggle_draw_coordinates() { menu_handler_.gui_->set_draw_coordinates(!menu_handler_.gui_->get_draw_coordinates()); - menu_handler_.gui_->invalidate_all(); } void console_handler::do_toggle_draw_terrain_codes() { menu_handler_.gui_->set_draw_terrain_codes(!menu_handler_.gui_->get_draw_terrain_codes()); - menu_handler_.gui_->invalidate_all(); } void console_handler::do_toggle_draw_num_of_bitmaps() { menu_handler_.gui_->set_draw_num_of_bitmaps(!menu_handler_.gui_->get_draw_num_of_bitmaps()); - menu_handler_.gui_->invalidate_all(); } void console_handler::do_toggle_whiteboard() diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 5e6a471c05a5..593a671aa33f 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -502,10 +502,6 @@ void play_controller::init_side_end() if (current_side() == 1 || !init_side_done_now_) sound::play_sound(tod.sounds, sound::SOUND_SOURCES); - if (!is_skipping_replay()){ - gui_->invalidate_all(); - } - if (!is_skipping_replay() && current_team().get_scroll_to_leader() && !map_start_.valid()){ gui_->scroll_to_leader(current_side(), game_display::ONSCREEN,false); } @@ -885,10 +881,6 @@ void play_controller::check_victory() gamestate().board_.check_victory(continue_level, found_player, found_network_player, invalidate_all, not_defeated, remove_from_carryover_on_defeat_); - if (invalidate_all) { - gui_->invalidate_all(); - } - if (continue_level) { return ; } @@ -948,7 +940,6 @@ void play_controller::update_gui_to_player(const int team_index, const bool obse { gui_->set_team(team_index, observe); gui_->recalculate_minimap(); - gui_->invalidate_all(); } void play_controller::do_autosave() @@ -1087,8 +1078,6 @@ std::set play_controller::all_players() const void play_controller::play_side() { - //check for team-specific items in the scenario - gui_->parse_team_overlays(); do { update_viewing_player(); { diff --git a/src/playsingle_controller.cpp b/src/playsingle_controller.cpp index a98ff400c442..e8ce552214fe 100644 --- a/src/playsingle_controller.cpp +++ b/src/playsingle_controller.cpp @@ -571,7 +571,6 @@ void playsingle_controller::play_ai_turn() gui_->recalculate_minimap(); gui_->invalidate_unit(); gui_->invalidate_game_status(); - gui_->invalidate_all(); } diff --git a/src/replay_controller.cpp b/src/replay_controller.cpp index 64a409f6c7d8..b6fbabdca53b 100644 --- a/src/replay_controller.cpp +++ b/src/replay_controller.cpp @@ -265,7 +265,6 @@ void replay_controller::update_gui() { controller_.get_display().recalculate_minimap(); controller_.get_display().redraw_minimap(); - controller_.get_display().invalidate_all(); } void replay_controller::handle_generic_event(const std::string& name) @@ -371,7 +370,6 @@ void replay_controller::replay_show_team1() void replay_controller::update_teams() { update_viewing_player(); - controller_.get_display().invalidate_all(); update_gui(); } diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index 3c57ccc16929..d1c0b410fa9a 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -895,7 +895,6 @@ int game_lua_kernel::intf_shroud_op(lua_State *L, bool place_shroud) game_display_->labels().recalculate_shroud(); game_display_->recalculate_minimap(); - game_display_->invalidate_all(); return 0; } @@ -2042,10 +2041,6 @@ int game_lua_kernel::intf_print(lua_State *L) { void game_lua_kernel::put_unit_helper(const map_location& loc) { - if(game_display_) { - game_display_->invalidate(loc); - } - units().erase(loc); resources::whiteboard->on_kill_unit(); } @@ -3293,7 +3288,6 @@ int game_lua_kernel::intf_color_adjust(lua_State *L) vconfig cfg(luaW_checkvconfig(L, 1)); game_display_->adjust_color_overlay(cfg["red"], cfg["green"], cfg["blue"]); - game_display_->invalidate_all(); game_display_->draw(true,true); } return 0; @@ -3346,13 +3340,6 @@ int game_lua_kernel::intf_redraw(lua_State *L) vconfig cfg(luaW_checkvconfig(L, 1)); bool clear_shroud(luaW_toboolean(L, 2)); - // We do this twice so any applicable redraws happen both before and after - // any events caused by redrawing shroud are fired - bool result = screen.maybe_rebuild(); - if (!result) { - screen.invalidate_all(); - } - if (clear_shroud) { side_filter filter(cfg, &game_state_); for (const int side : filter.get_teams()){ @@ -3361,11 +3348,6 @@ int game_lua_kernel::intf_redraw(lua_State *L) screen.recalculate_minimap(); } - result = screen.maybe_rebuild(); - if (!result) { - screen.invalidate_all(); - } - screen.draw(true,true); } return 0; @@ -3942,7 +3924,6 @@ int game_lua_kernel::intf_toggle_fog(lua_State *L, const bool clear) // Flag a screen update. game_display_->recalculate_minimap(); - game_display_->invalidate_all(); return 0; } diff --git a/src/synced_commands.cpp b/src/synced_commands.cpp index c05c15cac90a..446559607d47 100644 --- a/src/synced_commands.cpp +++ b/src/synced_commands.cpp @@ -456,7 +456,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_ if (name == "fail") { //testcase for bug #18488 assert(i.valid()); } - display::get_singleton()->invalidate(loc); + game_display::get_singleton()->invalidate_unit(); return true; diff --git a/src/units/animation.cpp b/src/units/animation.cpp index a09a3e8caff9..0d894525880c 100644 --- a/src/units/animation.cpp +++ b/src/units/animation.cpp @@ -1103,6 +1103,7 @@ void unit_animation::clear_haloes() } } +// TODO: see if this function can be removed! bool unit_animation::invalidate(frame_parameters& value) { if(invalidated_) return false; @@ -1129,16 +1130,13 @@ bool unit_animation::invalidate(frame_parameters& value) if(complete_redraw) { if( need_update()) { - disp->invalidate(overlaped_hex_); invalidated_ = true; return true; } else { - invalidated_ = disp->propagate_invalidation(overlaped_hex_); return invalidated_; } } else { if(need_minimal_update()) { - disp->invalidate(overlaped_hex_); invalidated_ = true; return true; } else { diff --git a/src/units/udisplay.cpp b/src/units/udisplay.cpp index fab4279e1ec8..639b99a3560d 100644 --- a/src/units/udisplay.cpp +++ b/src/units/udisplay.cpp @@ -74,7 +74,6 @@ static void teleport_unit_between(const map_location& a, const map_location& b, temp_unit.set_location(a); if ( !disp.fogged(a) ) { // teleport - disp.invalidate(a); temp_unit.set_facing(a.get_relative_dir(b)); disp.scroll_to_tiles(a, b, game_display::ONSCREEN, true, 0.0, false); unit_animator animator; @@ -85,7 +84,6 @@ static void teleport_unit_between(const map_location& a, const map_location& b, temp_unit.set_location(b); if ( !disp.fogged(b) ) { // teleport - disp.invalidate(b); temp_unit.set_facing(a.get_relative_dir(b)); disp.scroll_to_tiles(b, a, game_display::ONSCREEN, true, 0.0, false); unit_animator animator; @@ -125,7 +123,6 @@ static int move_unit_between(const map_location& a, const map_location& b, } temp_unit->set_location(a); - disp.invalidate(a); temp_unit->set_facing(a.get_relative_dir(b)); animator.replace_anim_if_invalid(temp_unit.get(),"movement",a,b,step_num, false,"",{0,0,0},unit_animation::hit_type::INVALID,nullptr,nullptr,step_left); @@ -260,7 +257,6 @@ void unit_mover::start(unit_ptr u) temp_unit_ptr_->set_location(path_[0]); temp_unit_ptr_->set_facing(path_[0].get_relative_dir(path_[1])); temp_unit_ptr_->anim_comp().set_standing(false); - disp_->invalidate(path_[0]); // If the unit can be seen here by the viewing side: if ( !is_enemy_ || !temp_unit_ptr_->invisible(path_[0], disp_->get_disp_context()) ) { @@ -329,7 +325,6 @@ void unit_mover::proceed_to(unit_ptr u, size_t path_index, bool update, bool wai { // prevent the unit from disappearing if we scroll here with i == 0 temp_unit_ptr_->set_location(path_[current_]); - disp_->invalidate(path_[current_]); // scroll in as much of the remaining path as possible if ( temp_unit_ptr_->anim_comp().get_animation() ) temp_unit_ptr_->anim_comp().get_animation()->pause_animation(); @@ -376,19 +371,6 @@ void unit_mover::wait_for_anims() animator_.wait_until(wait_until_); // debug code, see unit_frame::redraw() // std::cout << " end\n"; - /// @todo For wesnoth 1.14+: check if efficient for redrawing? - /// Check with large animated units too make sure artifacts are - /// not left on screen after unit movement in particular. - if ( disp_ ) { // Should always be true if we get here. - // Invalidate the hexes around the move that prompted this wait. - adjacent_loc_array_t arr; - get_adjacent_tiles(path_[current_-1], arr.data()); - for ( unsigned i = 0; i < arr.size(); ++i ) - disp_->invalidate(arr[i]); - get_adjacent_tiles(path_[current_], arr.data()); - for ( unsigned i = 0; i < arr.size(); ++i ) - disp_->invalidate(arr[i]); - } } // Reset data. @@ -455,10 +437,6 @@ void unit_mover::finish(unit_ptr u, map_location::DIRECTION dir) // Facing gets set even when not animating. u->set_facing(dir == map_location::NDIRECTIONS ? final_dir : dir); u->anim_comp().set_standing(true); // Need to reset u's animation so the new facing takes effect. - - // Redraw path ends (even if not animating). - disp_->invalidate(path_.front()); - disp_->invalidate(end_loc); } diff --git a/src/whiteboard/attack.cpp b/src/whiteboard/attack.cpp index 2bcbe3699041..39d33acd91bc 100644 --- a/src/whiteboard/attack.cpp +++ b/src/whiteboard/attack.cpp @@ -60,7 +60,6 @@ attack::attack(size_t team_index, bool hidden, unit& u, const map_location& targ attack_movement_cost_(get_unit()->attacks()[weapon_choice_].movement_used()), temp_movement_subtracted_(0) { - this->init(); } attack::attack(const config& cfg, bool hidden) @@ -80,18 +79,10 @@ attack::attack(const config& cfg, bool hidden) // Construct attack_movement_cost_ attack_movement_cost_ = get_unit()->attacks()[weapon_choice_].movement_used(); - - this->init(); -} - -void attack::init() -{ - display::get_singleton()->invalidate(target_hex_); } attack::~attack() { - invalidate(); } void attack::accept(visitor& v) @@ -99,17 +90,6 @@ void attack::accept(visitor& v) v.visit(shared_from_this()); } -/* private */ -void attack::invalidate() -{ - if(display::get_singleton()) - { - //invalidate dest and target hex so attack indicator is properly cleared - display::get_singleton()->invalidate(get_dest_hex()); - display::get_singleton()->invalidate(target_hex_); - } -} - void attack::execute(bool& success, bool& complete) { if(!valid()) { @@ -220,7 +200,6 @@ void attack::draw_hex(const map_location& hex) void attack::redraw() { move::redraw(); - display::get_singleton()->invalidate(target_hex_); } action::error attack::check_validity() const diff --git a/src/whiteboard/attack.hpp b/src/whiteboard/attack.hpp index 2d108f767782..fc3ff14b141f 100644 --- a/src/whiteboard/attack.hpp +++ b/src/whiteboard/attack.hpp @@ -67,14 +67,6 @@ class attack: public move private: - void init(); - - virtual void do_hide() {invalidate();} - virtual void do_show() {invalidate();} - - ///invalidates the move-destination and attack-target hexes - void invalidate(); - ///the target of the attack map_location target_hex_; diff --git a/src/whiteboard/manager.cpp b/src/whiteboard/manager.cpp index 0c98de8a8d3b..0d830a09a9d4 100644 --- a/src/whiteboard/manager.cpp +++ b/src/whiteboard/manager.cpp @@ -847,8 +847,6 @@ void manager::save_temp_attack(const map_location& attacker_loc, const map_locat print_help_once(); - display::get_singleton()->invalidate(defender_loc); - display::get_singleton()->invalidate(attacker_loc); erase_temp_move(); LOG_WB << *viewer_actions() << "\n"; } diff --git a/src/whiteboard/move.cpp b/src/whiteboard/move.cpp index 7d9be17182fd..1a99138cc34b 100644 --- a/src/whiteboard/move.cpp +++ b/src/whiteboard/move.cpp @@ -555,8 +555,6 @@ void move::calculate_move_cost() void move::redraw() { - display::get_singleton()->invalidate(get_source_hex()); - display::get_singleton()->invalidate(get_dest_hex()); update_arrow_style(); } diff --git a/src/whiteboard/recall.cpp b/src/whiteboard/recall.cpp index 2670dbf383cd..95a6c2feba1c 100644 --- a/src/whiteboard/recall.cpp +++ b/src/whiteboard/recall.cpp @@ -196,11 +196,6 @@ void recall::draw_hex(const map_location& hex) } } -void recall::redraw() -{ - display::get_singleton()->invalidate(recall_hex_); -} - action::error recall::check_validity() const { //Check that destination hex is still free diff --git a/src/whiteboard/recall.hpp b/src/whiteboard/recall.hpp index cf792080a4db..e5125fff197d 100644 --- a/src/whiteboard/recall.hpp +++ b/src/whiteboard/recall.hpp @@ -52,8 +52,6 @@ class recall: public action /** Gets called by display when drawing a hex, to allow actions to draw to the screen. */ virtual void draw_hex(const map_location& hex); - /** Redrawing function, called each time the action situation might have changed. */ - virtual void redraw(); /** * Indicates whether this hex is the preferred hex to draw the numbering for this action. diff --git a/src/whiteboard/recruit.cpp b/src/whiteboard/recruit.cpp index fbf3e5c62444..af8930559844 100644 --- a/src/whiteboard/recruit.cpp +++ b/src/whiteboard/recruit.cpp @@ -160,12 +160,6 @@ void recruit::draw_hex(const map_location& hex) } } -void recruit::redraw() -{ - display::get_singleton()->invalidate(recruit_hex_); -} - - unit_ptr recruit::create_corresponding_unit() { unit_type const* type = unit_types.find(unit_name_); diff --git a/src/whiteboard/recruit.hpp b/src/whiteboard/recruit.hpp index edd311ad8cc7..3306644c7c39 100644 --- a/src/whiteboard/recruit.hpp +++ b/src/whiteboard/recruit.hpp @@ -57,8 +57,6 @@ class recruit: public action /** Gets called by display when drawing a hex, to allow actions to draw to the screen. */ virtual void draw_hex(const map_location& hex); - /** Redrawing function, called each time the action situation might have changed. */ - virtual void redraw(); /** * @return the preferred hex to draw the numbering for this action. diff --git a/src/whiteboard/side_actions.cpp b/src/whiteboard/side_actions.cpp index 52fdb2ab79b0..b4be9fdba1de 100644 --- a/src/whiteboard/side_actions.cpp +++ b/src/whiteboard/side_actions.cpp @@ -722,12 +722,6 @@ void side_actions::execute_net_cmd(const net_cmd& cmd) } LOG_WB << "Command received: action inserted on turn #" << turn << ", position #" << pos << ": " << act << "\n"; - - //update numbering hexes as necessary - ++itor; - for(iterator end_itor = end(); itor != end_itor; ++itor) { - display::get_singleton()->invalidate((*itor)->get_numbering_hex()); - } } else if(type=="replace") { size_t turn = cmd["turn"].to_int(); size_t pos = cmd["pos"].to_int(); @@ -762,11 +756,6 @@ void side_actions::execute_net_cmd(const net_cmd& cmd) itor = safe_erase(itor); LOG_WB << "Command received: action removed on turn #" << turn << ", position #" << pos << "\n"; - - //update numbering hexes as necessary - for(iterator end_itor = end(); itor != end_itor; ++itor) { - display::get_singleton()->invalidate((*itor)->get_numbering_hex()); - } } else if(type=="bump_later") { size_t turn = cmd["turn"].to_int(); size_t pos = cmd["pos"].to_int(); @@ -782,10 +771,6 @@ void side_actions::execute_net_cmd(const net_cmd& cmd) bump_later(itor); LOG_WB << "Command received: action bumped later from turn #" << turn << ", position #" << pos << "\n"; - - //update numbering hexes as necessary - display::get_singleton()->invalidate(first_action->get_numbering_hex()); - display::get_singleton()->invalidate(second_action->get_numbering_hex()); } else if(type=="clear") { LOG_WB << "Command received: clear\n"; clear(); diff --git a/src/whiteboard/suppose_dead.cpp b/src/whiteboard/suppose_dead.cpp index f16303423d6b..803dc3248e3c 100644 --- a/src/whiteboard/suppose_dead.cpp +++ b/src/whiteboard/suppose_dead.cpp @@ -63,7 +63,6 @@ suppose_dead::suppose_dead(size_t team_index, bool hidden, unit& curr_unit, cons , unit_id_(curr_unit.id()) , loc_(loc) { - this->init(); } suppose_dead::suppose_dead(const config& cfg, bool hidden) @@ -79,20 +78,10 @@ suppose_dead::suppose_dead(const config& cfg, bool hidden) unit_underlying_id_ = unit_itor->underlying_id(); unit_id_ = unit_itor->id(); - - this->init(); -} - -void suppose_dead::init() -{ - display::get_singleton()->invalidate(loc_); } suppose_dead::~suppose_dead() { - //invalidate hex so that skull indicator is properly cleared - if(display::get_singleton()) - display::get_singleton()->invalidate(loc_); } unit_ptr suppose_dead::get_unit() const @@ -149,7 +138,6 @@ void suppose_dead::draw_hex(const map_location& hex) void suppose_dead::redraw() { - display::get_singleton()->invalidate(loc_); } action::error suppose_dead::check_validity() const diff --git a/src/whiteboard/suppose_dead.hpp b/src/whiteboard/suppose_dead.hpp index 0a026af90392..32e4fa84265b 100644 --- a/src/whiteboard/suppose_dead.hpp +++ b/src/whiteboard/suppose_dead.hpp @@ -77,9 +77,6 @@ class suppose_dead: public action size_t unit_underlying_id_; std::string unit_id_; map_location loc_; - -private: - void init(); }; /** Dumps a suppose_dead on a stream, for debug purposes. */ diff --git a/src/whiteboard/utility.cpp b/src/whiteboard/utility.cpp index a6b04ffbc168..2e606e2b3dc9 100644 --- a/src/whiteboard/utility.cpp +++ b/src/whiteboard/utility.cpp @@ -142,13 +142,11 @@ temporary_unit_hider::~temporary_unit_hider() void ghost_owner_unit(unit* unit) { unit->anim_comp().set_disabled_ghosted(false); - display::get_singleton()->invalidate(unit->get_location()); } void unghost_owner_unit(unit* unit) { unit->anim_comp().set_standing(true); - display::get_singleton()->invalidate(unit->get_location()); } bool has_actions()