[[Animation fixes]]

* Fixed attack animation not being complete.

* Fixed absence of animation when units without attack frame attack.
This commit is contained in:
Philippe Plantier 2004-07-20 20:27:49 +00:00
parent eb00d3bfdb
commit 8bdaccff45
2 changed files with 4 additions and 3 deletions

View file

@ -824,7 +824,7 @@ const std::string& unit::image() const
const unit_animation::frame& anim_frame = attackType_->animation().get_current_frame();
const std::string* const img = &anim_frame.image;
if(img == NULL)
if(img->empty())
return type_->image_fighting(attackType_->range());
else
return *img;

View file

@ -618,10 +618,10 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
unit_animation attack_anim = attack.animation();
attack_anim.start_animation(begin_at, unit_animation::UNIT_FRAME, acceleration);
while(!attack_anim.animation_finished()) {
int animation_time = attack_anim.get_animation_time();
while(animation_time < end_at) {
events::pump();
int animation_time = attack_anim.get_animation_time();
def->second.set_defending(true,hits,animation_time,attack_type::SHORT_RANGE);
//this is a while instead of an if, because there might be multiple
@ -740,6 +740,7 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
ticks = SDL_GetTicks();
attack_anim.update_current_frames();
animation_time = attack_anim.get_animation_time();
disp.update_display();
}