Skip to content

Commit

Permalink
remove unnnecessary location argument from unit::invalidate
Browse files Browse the repository at this point in the history
This function was always called with the current location of the
unit as the argument, so we simplify it.
  • Loading branch information
cbeck88 committed Jun 10, 2014
1 parent 654fd22 commit 2282f6e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/actions/move.cpp
Expand Up @@ -494,7 +494,7 @@ namespace { // Private helpers for move_unit()
moves_left_.pop_front();

// Invalidate before moving so we invalidate neighbor hexes if needed.
move_it_->invalidate(disp, *move_loc_);
move_it_->invalidate(disp);

// Attempt actually moving.
// (Fails if *step_to is occupied).
Expand Down
2 changes: 1 addition & 1 deletion src/display.cpp
Expand Up @@ -3067,7 +3067,7 @@ void display::invalidate_animations()
#pragma omp parallel for reduction(|:new_inval) shared(unit_list) schedule(guided)
#endif //_OPENMP
for(int i=0; i < static_cast<int>(unit_list.size()); i++) {
new_inval |= unit_list[i]->invalidate(*this,unit_list[i]->get_location());
new_inval |= unit_list[i]->invalidate(*this);
}
}while(new_inval);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_events/action_wml.cpp
Expand Up @@ -945,7 +945,7 @@ WML_HANDLER_FUNCTION(kill, event_info, cfg)
resources::screen->invalidate(loc);
unit_map::iterator iun = resources::units->find(loc);
if ( iun != resources::units->end() && iun.valid() )
iun->invalidate(*resources::screen, loc);
iun->invalidate(*resources::screen);
}
resources::screen->redraw_minimap();

Expand Down
4 changes: 2 additions & 2 deletions src/unit.cpp
Expand Up @@ -2159,15 +2159,15 @@ void unit::clear_haloes()
}
if(anim_ ) anim_->clear_haloes();
}
bool unit::invalidate(const display & disp, const map_location &loc)
bool unit::invalidate(const display & disp)
{
bool result = false;

// Very early calls, anim not initialized yet
if(get_animation()) {
frame_parameters params;
const gamemap & map = disp.get_map();
const t_translation::t_terrain terrain = map.get_terrain(loc);
const t_translation::t_terrain terrain = map.get_terrain(get_location());
const terrain_type& terrain_info = map.get_terrain_info(terrain);

int height_adjust = static_cast<int>(terrain_info.unit_height_adjust() * disp.get_zoom_factor());
Expand Down
2 changes: 1 addition & 1 deletion src/unit.hpp
Expand Up @@ -265,7 +265,7 @@ class unit
void set_facing(map_location::DIRECTION dir);
map_location::DIRECTION facing() const { return facing_; }

bool invalidate(const display & disp, const map_location &loc);
bool invalidate(const display & disp);
const std::vector<t_string>& trait_names() const { return trait_names_; }
const std::vector<t_string>& trait_descriptions() const { return trait_descriptions_; }
std::vector<std::string> get_traits_list() const;
Expand Down
6 changes: 3 additions & 3 deletions src/whiteboard/manager.cpp
Expand Up @@ -716,7 +716,7 @@ void manager::create_temp_move()
}

unit_display::move_unit(path, *fake_unit, false); //get facing right
fake_unit->invalidate(*game_display::get_singleton(), fake_unit->get_location());
fake_unit->invalidate(*game_display::get_singleton());
fake_unit->set_location(*curr_itor);
fake_unit->set_ghosted(true);
}
Expand All @@ -728,7 +728,7 @@ void manager::create_temp_move()
}
//in case path shortens on next step and one ghosted unit has to be removed
int ind = fake_units_.size() - 1;
fake_units_[ind]->invalidate(*game_display::get_singleton(),fake_units_[ind]->get_location());
fake_units_[ind]->invalidate(*game_display::get_singleton());
//toss out old arrows and fake units
move_arrows_.resize(turn+1);
fake_units_.resize(turn+1);
Expand All @@ -739,7 +739,7 @@ void manager::erase_temp_move()
move_arrows_.clear();
BOOST_FOREACH(fake_unit_ptr const& tmp, fake_units_) {
if(tmp) {
tmp->invalidate(*game_display::get_singleton(),tmp->get_location());
tmp->invalidate(*game_display::get_singleton());
}
}
fake_units_.clear();
Expand Down

0 comments on commit 2282f6e

Please sign in to comment.