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 Mar 8, 2018
1 parent 6c24298 commit d3681e4
Show file tree
Hide file tree
Showing 42 changed files with 9 additions and 593 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();
display::get_singleton()->invalidate(loc);
events::pump();
}

display::get_singleton()->invalidate_all();

return true;
}

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

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 (display::get_singleton() != nullptr) {
display::get_singleton()->invalidate(loc);
}
return t->get_village(loc, old_owner_side, fire_event ? resources::gamedata : nullptr);
}

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

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

Expand All @@ -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();
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 (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);
}
}
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 ) {
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?
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().
display::get_singleton()->invalidate_all();

shroud_clearer clearer;
for (const unit &u : resources::gameboard->units())
Expand Down
14 changes: 0 additions & 14 deletions src/arrow.cpp
Expand Up @@ -53,7 +53,6 @@ void arrow::hide()
hidden_ = true;

if(display* disp = display::get_singleton()) {
invalidate_arrow_path(path_);
disp->remove_arrow(*this);
}
}
Expand All @@ -78,16 +77,13 @@ void arrow::set_path(const arrow_path_t& 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 @@ -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

Expand Down Expand Up @@ -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()) {
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(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();

Expand Down

0 comments on commit d3681e4

Please sign in to comment.