From 10b12b1fd0bfa3ae7d7bcecaadb9f5e2e4b52f96 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 | 6 - 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 | 15 -- src/arrow.hpp | 2 - src/display.cpp | 251 +----------------- src/display.hpp | 43 --- 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 | 46 ---- 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 | 1 - 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, 8 insertions(+), 592 deletions(-) diff --git a/src/actions/advancement.cpp b/src/actions/advancement.cpp index 77e80bea423f..fb1a611fd14d 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(); - resources::screen->invalidate(loc); events::pump(); } - resources::screen->invalidate_all(); - return true; } diff --git a/src/actions/attack.cpp b/src/actions/attack.cpp index f509a17bbb35..53841b383d1b 100644 --- a/src/actions/attack.cpp +++ b/src/actions/attack.cpp @@ -1095,7 +1095,6 @@ namespace { { attacker.xp_ = game_config::kill_xp(defender.get_unit().level()); defender.xp_ = 0; - resources::screen->invalidate(attacker.loc_); game_events::entity_location death_loc(defender.loc_, defender.id_); game_events::entity_location attacker_loc(attacker.loc_, attacker.id_); @@ -1173,9 +1172,6 @@ namespace { resources::game_events->pump().fire("unit_placed", reanim_loc); preferences::encountered_units().insert(newunit->type_id()); - if (update_display_) { - resources::screen->invalidate(death_loc); - } } } else @@ -1323,8 +1319,6 @@ namespace { if (update_display_){ resources::screen->invalidate_unit(); - resources::screen->invalidate(a_.loc_); - resources::screen->invalidate(d_.loc_); resources::screen->draw(true, true); } diff --git a/src/actions/create.cpp b/src/actions/create.cpp index e4c89a92222a..bccaab6f5364 100644 --- a/src/actions/create.cpp +++ b/src/actions/create.cpp @@ -663,7 +663,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 ( resources::screen != nullptr ) { - resources::screen->invalidate(current_loc); resources::screen->redraw_minimap(); } diff --git a/src/actions/move.cpp b/src/actions/move.cpp index e799649163e9..39ac614da247 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 (resources::screen != nullptr) { - resources::screen->invalidate(loc); - } return t->get_village(loc, old_owner_side, fire_event ? resources::gamedata : nullptr); } @@ -539,7 +536,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. @@ -906,8 +902,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 22fce5ec6e75..61c734c7c510 100644 --- a/src/actions/undo_recall_action.cpp +++ b/src/actions/undo_recall_action.cpp @@ -51,7 +51,6 @@ void recall_action::write(config & cfg) const */ bool recall_action::undo(int side) { - game_display & gui = *resources::screen; unit_map & units = resources::gameboard->units(); team ¤t_team = resources::gameboard->get_team(side); @@ -76,9 +75,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 4af65fa1cce1..0f824a981543 100644 --- a/src/actions/undo_recruit_action.cpp +++ b/src/actions/undo_recruit_action.cpp @@ -52,7 +52,6 @@ void recruit_action::write(config & cfg) const */ bool recruit_action::undo(int side) { - game_display & gui = *resources::screen; unit_map & units = resources::gameboard->units(); team ¤t_team = resources::gameboard->get_team(side); @@ -69,9 +68,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 3167e417c7a8..d782e7e33b72 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 (resources::screen!=nullptr) { - - if (invalidate_ ) { - resources::screen->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 c90fcec2923f..214df52ea6a1 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 ) { - resources::screen->invalidate(loc); - // Need to also invalidate adjacent hexes to get rid of the - // "fog edge" graphics. - map_location adjacent[6]; - get_adjacent_tiles(loc, adjacent); - for ( int i = 0; i != 6; ++i ) - resources::screen->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(). - resources::screen->invalidate_all(); shroud_clearer clearer; for (const unit &u : resources::gameboard->units()) diff --git a/src/arrow.cpp b/src/arrow.cpp index 0c7b227aa5cd..d1cd56430cef 100644 --- a/src/arrow.cpp +++ b/src/arrow.cpp @@ -57,7 +57,6 @@ void arrow::hide() if (SCREEN) { - invalidate_arrow_path(path_); SCREEN->remove_arrow(*this); } } @@ -81,7 +80,6 @@ void arrow::set_path(arrow_path_t const& path) update_symbols(); if(!hidden_) { - invalidate_arrow_path(previous_path_); notify_arrow_changed(); } } @@ -89,8 +87,6 @@ void arrow::set_path(arrow_path_t const& path) void arrow::reset() { - invalidate_arrow_path(previous_path_); - invalidate_arrow_path(path_); previous_path_.clear(); path_.clear(); symbols_map_.clear(); @@ -165,7 +161,6 @@ void arrow::update_symbols() } symbols_map_.clear(); - invalidate_arrow_path(path_); const std::string mods = "~RC(FF00FF>"+ color_ + ")"; //magenta to current color @@ -286,16 +281,6 @@ void arrow::update_symbols() } } -void arrow::invalidate_arrow_path(arrow_path_t const& path) -{ - if(!SCREEN) return; - - for (map_location const& loc : path) - { - SCREEN->invalidate(loc); - } -} - void arrow::notify_arrow_changed() { if(!SCREEN) return; diff --git a/src/arrow.hpp b/src/arrow.hpp index 2f39ed55bd8b..69dfec0b4941 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(arrow_path_t const& path); - /// Invalidates every hex along the given path - static void invalidate_arrow_path(arrow_path_t const& path); virtual void notify_arrow_changed(); diff --git a/src/display.cpp b/src/display.cpp index de5d620d9f18..092cecfcf8ad 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -83,24 +83,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_) { @@ -175,7 +157,6 @@ display::display(const display_context* dc, , minimap_location_(sdl::empty_rect) , redrawMinimap_(false) , redraw_background_(true) - , invalidateAll_(true) , grid_(false) , diagnostic_label_(0) , panelsDrawn_(false) @@ -192,8 +173,6 @@ display::display(const display_context* dc, , reports_() , menu_buttons_() , action_buttons_() - , invalidated_() - , previous_invalidated_() , mouseover_hex_overlay_(nullptr) , tod_hex_mask1(nullptr) , tod_hex_mask2(nullptr) @@ -213,7 +192,6 @@ display::display(const display_context* dc, , 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) @@ -260,10 +238,6 @@ display::display(const display_context* dc, rebuild_all(); assert(builder_); //builder_->rebuild_cache_all(); - invalidate_all(); - - //invalidate_locations_in_rect(map_area()); - } display::~display() @@ -814,7 +788,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); @@ -1267,14 +1240,9 @@ void display::draw_debugging_aids() stream << "fps: " << fps; 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); @@ -1288,7 +1256,6 @@ void display::draw_debugging_aids() font::remove_floating_label(fps_handle_); fps_handle_ = 0; drawn_hexes_ = 0; - invalidated_hexes_ = 0; } } @@ -1411,17 +1378,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) @@ -1451,10 +1414,6 @@ void display::draw_init() return; } - if(benchmark) { - invalidateAll_ = true; - } - if(!panelsDrawn_) { draw_all_panels(); panelsDrawn_ = true; @@ -1468,19 +1427,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; } } @@ -1809,7 +1755,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. @@ -2415,100 +2360,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(); @@ -2520,11 +2371,7 @@ void display::invalidate_animations() continue; } - if(builder_->update_animation(loc)) { - invalidate(loc); - } else { - invalidate_animations_location(loc); - } + builder_->update_animation(loc); } } @@ -2629,46 +2476,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 @@ -2722,8 +2529,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 @@ -2733,19 +2539,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(); @@ -2802,7 +2595,7 @@ void display::redraw_everything() } int ticks1 = SDL_GetTicks(); - invalidate_all(); + //invalidate_all(); int ticks2 = SDL_GetTicks(); draw(true,true); int ticks3 = SDL_GetTicks(); @@ -2812,44 +2605,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 4d92f0392359..ace4bc237e00 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -135,12 +135,6 @@ class display : public filter_context, 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. * @@ -412,35 +406,11 @@ class display : public filter_context, 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); - /** * mouseover_hex_overlay_ require a prerendered surface * and is drawn underneath the mouse's location @@ -693,14 +663,6 @@ class display : public filter_context, 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. @@ -759,7 +721,6 @@ class display : public filter_context, public video2::draw_layering SDL_Rect minimap_location_; bool redrawMinimap_; bool redraw_background_; - bool invalidateAll_; bool grid_; int diagnostic_label_; bool panelsDrawn_; @@ -786,8 +747,6 @@ class display : public filter_context, public video2::draw_layering std::map reportSurfaces_; std::map reports_; std::vector> menu_buttons_, action_buttons_; - std::set invalidated_; - std::set previous_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. @@ -890,7 +849,6 @@ class display : public filter_context, 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; @@ -902,7 +860,6 @@ class display : public filter_context, 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 762728cef63f..de3b1a4aa483 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; - map_location adjacent[6]; - get_adjacent_tiles(previous_move_hex_, adjacent); - - for (int i = 0; i < 6; 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 73a678bfcc9b..abaddd3d2860 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; - map_location adjacent[6]; - get_adjacent_tiles(previous_move_hex_, adjacent); - - for (int i = 0; i < 6; 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 e2f6c039f365..bfd7e9a8864a 100644 --- a/src/editor/controller/editor_controller.cpp +++ b/src/editor/controller/editor_controller.cpp @@ -970,17 +970,14 @@ bool editor_controller::execute_command(const hotkey::hotkey_command& cmd, int i 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()); @@ -1109,7 +1106,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 ff0a5f1c7ccd..f20c5145ed27 100644 --- a/src/editor/editor_display.cpp +++ b/src/editor/editor_display.cpp @@ -70,26 +70,21 @@ editor_display::editor_display(editor_controller& controller, CVideo& video, rep 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 6bca1509d1fe..4baac87a8671 100644 --- a/src/editor/map/context_manager.cpp +++ b/src/editor/map/context_manager.cpp @@ -140,7 +140,6 @@ void context_manager::refresh_all() gui_.rebuild_all(); get_map_context().set_needs_terrain_rebuild(false); gui_.create_buttons(); - gui_.invalidate_all(); gui_.draw(false); get_map_context().clear_changed_locations(); gui_.recalculate_minimap(); @@ -546,18 +545,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 ea61d9baf07c..51ee3df119b3 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 0ec867dab477..8e9f74452297 100644 --- a/src/floating_textbox.cpp +++ b/src/floating_textbox.cpp @@ -37,7 +37,7 @@ namespace gui{ label_(0) {} - void floating_textbox::close(game_display& gui) + void floating_textbox::close(game_display& /*gui*/) { if(!active()) { return; @@ -51,7 +51,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 ab05fc2acd4f..cbd2f87c104c 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -138,7 +138,6 @@ void game_display::new_turn() tod_hex_mask2.assign(new_mask); } - invalidate_all(); draw(); const int cur_ticks = SDL_GetTicks(); @@ -157,7 +156,6 @@ void game_display::new_turn() display::update_tod(); - invalidate_all(); draw(); } @@ -232,8 +230,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 @@ -248,25 +244,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(); @@ -474,7 +451,6 @@ void game_display::set_game_mode(const game_mode mode) { if(mode != mode_) { mode_ = mode; - invalidate_all(); } } @@ -651,28 +627,14 @@ void game_display::unhighlight_reach() reach_map_changed_ = true; } - - -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) @@ -701,14 +663,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_); } } @@ -738,7 +694,6 @@ void game_display::begin_game() { in_game_ = true; create_buttons(); - invalidate_all(); } void game_display::needs_rebuild(bool b) { @@ -751,7 +706,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 ed7fe8897e35..d2444f5150ff 100644 --- a/src/game_display.hpp +++ b/src/game_display.hpp @@ -143,8 +143,6 @@ class game_display : public display */ void post_draw(); - void draw_invalidated(); - void post_commit(); void draw_hex(const map_location& loc); @@ -244,8 +242,6 @@ class game_display : public display const tod_manager* tod_manager_; - 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 5e95b403e18e..ad50b4c45c79 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 5b4251cbdf72..a945409d4c0f 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -942,13 +942,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) @@ -956,7 +954,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()); @@ -971,7 +968,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()); @@ -1896,18 +1892,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 93d944252962..6c37422ce5d8 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()){ gui_->scroll_to_leader(current_side(), game_display::ONSCREEN,false); } @@ -884,10 +880,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 ; } @@ -947,7 +939,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(); gui_->draw(true,true); } @@ -1086,8 +1077,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 c3c19ab267e4..2fad7e5eb33a 100644 --- a/src/playsingle_controller.cpp +++ b/src/playsingle_controller.cpp @@ -574,7 +574,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 445e0bb4fd13..3eaa222b5df5 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(); controller_.get_display().draw(); } @@ -372,7 +371,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 160682f7a783..7d30989119ad 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -903,7 +903,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; } @@ -2018,10 +2017,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); } @@ -3270,7 +3265,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; @@ -3322,13 +3316,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()){ @@ -3337,11 +3324,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; @@ -3917,7 +3899,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 df60c067e060..f0a3a6490b48 100644 --- a/src/synced_commands.cpp +++ b/src/synced_commands.cpp @@ -452,7 +452,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_ if (name == "fail") { //testcase for bug #18488 assert(i.valid()); } - resources::screen->invalidate(loc); resources::screen->invalidate_unit(); return true; diff --git a/src/units/animation.cpp b/src/units/animation.cpp index 9c21facbf0cd..c3ee345b8105 100644 --- a/src/units/animation.cpp +++ b/src/units/animation.cpp @@ -1102,6 +1102,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; @@ -1128,16 +1129,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 032ebe686f7f..95d3eb243dbb 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()) ) { @@ -343,7 +339,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(); @@ -390,19 +385,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. - map_location arr[6]; - get_adjacent_tiles(path_[current_-1], arr); - for ( unsigned i = 0; i < 6; ++i ) - disp_->invalidate(arr[i]); - get_adjacent_tiles(path_[current_], arr); - for ( unsigned i = 0; i < 6; ++i ) - disp_->invalidate(arr[i]); - } } // Reset data. @@ -469,10 +451,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 8d1698cc19e8..68c89e9dcd36 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(config const& cfg, bool hidden) @@ -80,18 +79,10 @@ attack::attack(config const& cfg, bool hidden) // Construct attack_movement_cost_ attack_movement_cost_ = get_unit()->attacks()[weapon_choice_].movement_used(); - - this->init(); -} - -void attack::init() -{ - resources::screen->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(resources::screen) - { - //invalidate dest and target hex so attack indicator is properly cleared - resources::screen->invalidate(get_dest_hex()); - resources::screen->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(); - resources::screen->invalidate(target_hex_); } action::error attack::check_validity() const diff --git a/src/whiteboard/attack.hpp b/src/whiteboard/attack.hpp index cbf759a06d17..d159bf7b9d62 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 7e4c963b37f5..96b8cbabb97b 100644 --- a/src/whiteboard/manager.cpp +++ b/src/whiteboard/manager.cpp @@ -840,8 +840,6 @@ void manager::save_temp_attack(const map_location& attacker_loc, const map_locat print_help_once(); - resources::screen->invalidate(defender_loc); - resources::screen->invalidate(attacker_loc); erase_temp_move(); LOG_WB << *viewer_actions() << "\n"; } diff --git a/src/whiteboard/move.cpp b/src/whiteboard/move.cpp index 653500dc5bdc..f86e8e0162f9 100644 --- a/src/whiteboard/move.cpp +++ b/src/whiteboard/move.cpp @@ -555,8 +555,6 @@ void move::calculate_move_cost() void move::redraw() { - resources::screen->invalidate(get_source_hex()); - resources::screen->invalidate(get_dest_hex()); update_arrow_style(); } diff --git a/src/whiteboard/recall.cpp b/src/whiteboard/recall.cpp index 666affdee542..0ca6d11a5304 100644 --- a/src/whiteboard/recall.cpp +++ b/src/whiteboard/recall.cpp @@ -196,11 +196,6 @@ void recall::draw_hex(map_location const& hex) } } -void recall::redraw() -{ - resources::screen->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 23789b26410c..30850b03ee62 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 67edf4a9c88c..ae007792dcdc 100644 --- a/src/whiteboard/recruit.cpp +++ b/src/whiteboard/recruit.cpp @@ -160,12 +160,6 @@ void recruit::draw_hex(map_location const& hex) } } -void recruit::redraw() -{ - resources::screen->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 4a3778a99961..e54399ce2ff5 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(map_location const& 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 6511679c57a9..ce2b5ac1580d 100644 --- a/src/whiteboard/side_actions.cpp +++ b/src/whiteboard/side_actions.cpp @@ -722,12 +722,6 @@ void side_actions::execute_net_cmd(net_cmd const& 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) { - resources::screen->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(net_cmd const& 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) { - resources::screen->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(net_cmd const& cmd) bump_later(itor); LOG_WB << "Command received: action bumped later from turn #" << turn << ", position #" << pos << "\n"; - - //update numbering hexes as necessary - resources::screen->invalidate(first_action->get_numbering_hex()); - resources::screen->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 9c85c66e55a7..dcac3c48ebff 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, map_ , unit_id_(curr_unit.id()) , loc_(loc) { - this->init(); } suppose_dead::suppose_dead(config const& cfg, bool hidden) @@ -79,20 +78,10 @@ suppose_dead::suppose_dead(config const& cfg, bool hidden) unit_underlying_id_ = unit_itor->underlying_id(); unit_id_ = unit_itor->id(); - - this->init(); -} - -void suppose_dead::init() -{ - resources::screen->invalidate(loc_); } suppose_dead::~suppose_dead() { - //invalidate hex so that skull indicator is properly cleared - if(resources::screen) - resources::screen->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() { - resources::screen->invalidate(loc_); } action::error suppose_dead::check_validity() const diff --git a/src/whiteboard/suppose_dead.hpp b/src/whiteboard/suppose_dead.hpp index cae2638a1d68..22e382141ef6 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 be6accacffa8..a1181a0afe97 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); - resources::screen->invalidate(unit->get_location()); } void unghost_owner_unit(unit* unit) { unit->anim_comp().set_standing(true); - resources::screen->invalidate(unit->get_location()); } bool has_actions()