Clear the unit visiblilty cache after moves.

Fixes a glitch sometimes when ambushed, the uncovered would
not show up. (I got a savegame where it always happens.)
This commit is contained in:
Martin Renold 2008-03-01 15:45:18 +00:00
parent 2098a1663c
commit ccc5edbe79
4 changed files with 5 additions and 3 deletions

View file

@ -2164,6 +2164,7 @@ size_t move_unit(game_display* disp,
p->first = steps.back();
units.add(p);
ui = units.find(p->first);
unit::clear_status_caches();
if(move_recorder != NULL) {
move_recorder->add_movement(steps.front(),steps.back());

View file

@ -1324,6 +1324,7 @@ private:
up->second.set_movement(starting_moves);
up->first = route.back();
units_.add(up);
unit::clear_status_caches();
up->second.set_standing(up->first);
gui_->invalidate(route.back());
gui_->draw();
@ -1440,6 +1441,7 @@ private:
up->second.set_movement(starting_moves);
up->first = route.back();
units_.add(up);
unit::clear_status_caches();
up->second.set_standing(up->first);
if(map_.is_village(route.back())) {

View file

@ -1084,6 +1084,7 @@ bool do_replay_handle(game_display& disp, const gamemap& map, const game_data& g
std::pair<gamemap::location,unit> *up = units.extract(u->first);
up->first = dst;
units.add(up);
unit::clear_status_caches();
if (up->first == up->second.get_goto())
{
//if unit has arrived to destination, goto variable is cleaned

View file

@ -50,9 +50,7 @@ public:
class unit
{
public:
//! @todo Unclear comment:
// clear the status caches for esch unit, this is should be called it
// the status of a unit changes
//! Clear the unit status cache for all units. Currently only the hidden status of units is cached this way.
static void clear_status_caches();
friend struct unit_movement_resetter;