fix idle anims not finishing correctly

This commit is contained in:
Jérémy Rosen 2009-05-20 16:33:13 +00:00
parent 8c07aedc6a
commit 7e033fff4e
3 changed files with 7 additions and 4 deletions

View file

@ -1555,7 +1555,7 @@ bool display::tile_fully_on_screen(const map_location& loc)
return !outside_area(map_area(), x, y);
}
bool display::tile_nearly_on_screen(const map_location& loc)
bool display::tile_nearly_on_screen(const map_location& loc) const
{
int x = get_location_x(loc);
int y = get_location_y(loc);

View file

@ -446,7 +446,7 @@ public:
bool tile_fully_on_screen(const map_location& loc);
/** Checks if location @a loc or one of the adjacent tiles is visible on screen. */
bool tile_nearly_on_screen(const map_location &loc);
bool tile_nearly_on_screen(const map_location &loc) const;
/**
* Draws invalidated items.

View file

@ -146,12 +146,15 @@ public:
void new_scenario();
/** Called on every draw */
void refresh(const game_display& disp,const map_location& loc) {
if (state_ != STATE_STANDING || get_current_animation_tick() < next_idling_ || incapacitated())
return;
if (state_ == STATE_FORGET && anim_ && anim_->animation_finished_potential()) {
set_standing(loc);
return;
}
if (state_ != STATE_STANDING ||
get_current_animation_tick() < next_idling_ ||
!disp.tile_nearly_on_screen(loc) ||
incapacitated())
return;
if (get_current_animation_tick() > next_idling_ + 1000) {
// prevent all units animating at the same time
if (disp.idle_anim()) {