Skip to content

Commit

Permalink
Display: removed all the invalidated locations code
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vultraz committed Jul 31, 2017
1 parent 2f77821 commit 10b12b1
Show file tree
Hide file tree
Showing 42 changed files with 8 additions and 592 deletions.
3 changes: 0 additions & 3 deletions src/actions/advancement.cpp
Expand Up @@ -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;
}

Expand Down
6 changes: 0 additions & 6 deletions src/actions/attack.cpp
Expand Up @@ -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_);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion src/actions/create.cpp
Expand Up @@ -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();
}

Expand Down
6 changes: 0 additions & 6 deletions src/actions/move.cpp
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/actions/undo_recall_action.cpp
Expand Up @@ -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 &current_team = resources::gameboard->get_team(side);

Expand All @@ -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();
Expand Down
4 changes: 0 additions & 4 deletions src/actions/undo_recruit_action.cpp
Expand Up @@ -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 &current_team = resources::gameboard->get_team(side);

Expand All @@ -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();
Expand Down
11 changes: 2 additions & 9 deletions src/actions/unit_creator.cpp
Expand Up @@ -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);
}
}
14 changes: 0 additions & 14 deletions src/actions/vision.cpp
Expand Up @@ -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?
Expand Down Expand Up @@ -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())
Expand Down
15 changes: 0 additions & 15 deletions src/arrow.cpp
Expand Up @@ -57,7 +57,6 @@ void arrow::hide()

if (SCREEN)
{
invalidate_arrow_path(path_);
SCREEN->remove_arrow(*this);
}
}
Expand All @@ -81,16 +80,13 @@ void arrow::set_path(arrow_path_t const& path)
update_symbols();
if(!hidden_)
{
invalidate_arrow_path(previous_path_);
notify_arrow_changed();
}
}
}

void arrow::reset()
{
invalidate_arrow_path(previous_path_);
invalidate_arrow_path(path_);
previous_path_.clear();
path_.clear();
symbols_map_.clear();
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/arrow.hpp
Expand Up @@ -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();

Expand Down

0 comments on commit 10b12b1

Please sign in to comment.