fix a sync glitch discovered while looking into th ghoul bug

This commit is contained in:
Jérémy Rosen 2008-01-04 20:33:34 +00:00
parent 2b1f591ec2
commit 8d10b3d16a
2 changed files with 11 additions and 12 deletions

View File

@ -840,9 +840,19 @@ void unit_animator::replace_anim_if_invalid(unit* animated_unit,const std::strin
}
void unit_animator::start_animations()
{
int begin_time = INT_MAX;
for(std::vector<anim_elem>::const_iterator anim = animated_units_.begin(); anim != animated_units_.end();anim++) {
if(anim->my_unit->get_animation()) {
if(anim->animation) {
begin_time = minimum<int>(begin_time,anim->animation->get_begin_time());
} else {
begin_time = minimum<int>(begin_time,anim->my_unit->get_animation()->get_begin_time());
}
}
}
for(std::vector<anim_elem>::iterator anim = animated_units_.begin(); anim != animated_units_.end();anim++) {
if(anim->animation) {
anim->my_unit->start_animation(get_begin_time(),anim->src, anim->animation,anim->with_bars, anim->cycles,anim->text,anim->text_color);
anim->my_unit->start_animation(begin_time,anim->src, anim->animation,anim->with_bars, anim->cycles,anim->text,anim->text_color);
anim->animation = NULL;
}
@ -896,13 +906,3 @@ int unit_animator::get_end_time() const
}
return end_time;
}
int unit_animator::get_begin_time() const
{
int begin_time = INT_MAX;
for(std::vector<anim_elem>::const_iterator anim = animated_units_.begin(); anim != animated_units_.end();anim++) {
if(anim->my_unit->get_animation()) {
begin_time = minimum<int>(begin_time,anim->my_unit->get_animation()->get_begin_time());
}
}
return begin_time;
}

View File

@ -157,7 +157,6 @@ class unit_animator
bool would_end() const;
int get_animation_time() const;
int get_end_time() const;
int get_begin_time() const;
void wait_for_end() const;
void wait_until( int animation_time) const;
private: