fixed intermittent crash at end of replay

This commit is contained in:
David White 2006-01-24 00:47:39 +00:00
parent bf6a7f7e77
commit 42303e0a17
3 changed files with 9 additions and 6 deletions

View file

@ -241,7 +241,7 @@ const bool replay_controller::is_loading_game(){
}
void replay_controller::objectives(){
menu_handler_.objectives(*gui_, level_, teams_[player_number_]);
menu_handler_.objectives(*gui_, level_, current_team());
}
void replay_controller::show_statistics(){
@ -545,9 +545,9 @@ void replay_controller::replay_slice()
gui_->draw();
if(!mouse_handler_.browse() && teams_[player_number_].objectives_changed()) {
dialogs::show_objectives(*gui_, level_, teams_[player_number_].objectives());
teams_[player_number_].reset_objectives_changed();
if(!mouse_handler_.browse() && current_team().objectives_changed()) {
dialogs::show_objectives(*gui_, level_, current_team().objectives());
current_team().reset_objectives_changed();
}
}

View file

@ -77,6 +77,9 @@ private:
void update_teams();
void update_gui();
team& current_team() { return teams_[player_number_-1]; }
const team& current_team() const { return teams_[player_number_-1]; }
//managers
const verification_manager verify_manager_;
teams_manager team_manager_;

View file

@ -1074,8 +1074,8 @@ void unit::set_healing()
void unit::set_walking(const std::string terrain,gamemap::location::DIRECTION dir,int acceleration)
{
update_frame();
if(state_ == STATE_WALKING &&
dynamic_cast<movement_animation*>(anim_)->matches(terrain,dir) >=0) {
movement_animation* const anim = dynamic_cast<movement_animation*>(anim_);
if(state_ == STATE_WALKING && anim != NULL && anim->matches(terrain,dir) >=0) {
return; // finish current animation, don't start a new one
}
state_ = STATE_WALKING;