Fixed segfault in the animation code caused by a triggered level end...

...required just before moving a unit with WML code after having
changed the objectives.

Objective display has been moved out of the animation code and into a
randomly-chosen function. The target function is probably not the most
sensible choice, but the upside is that it should be called at all the
important times.
This commit is contained in:
Guillaume Melquiond 2010-08-11 16:05:51 +00:00
parent 35bb8015c5
commit 6487a3d046
3 changed files with 9 additions and 10 deletions

View File

@ -956,14 +956,6 @@ void play_controller::slice_before_scroll() {
soundsources_manager_->update();
}
void play_controller::slice_end() {
if(!browse_ && teams_[gui_->viewing_team()].objectives_changed()) {
check_end_level();
dialogs::show_objectives(level_, teams_[gui_->viewing_team()].objectives());
teams_[gui_->viewing_team()].reset_objectives_changed();
}
}
events::mouse_handler& play_controller::get_mouse_handler_base() {
return mouse_handler_;
}

View File

@ -142,7 +142,6 @@ public:
protected:
void slice_before_scroll();
void slice_end();
game_display& get_display();
bool have_keyboard_focus();

View File

@ -25,6 +25,7 @@
#include "ai/manager.hpp"
#include "ai/game_info.hpp"
#include "ai/testing.hpp"
#include "dialogs.hpp"
#include "foreach.hpp"
#include "game_end_exceptions.hpp"
#include "game_events.hpp"
@ -146,8 +147,15 @@ void playsingle_controller::force_end_turn(){
void playsingle_controller::check_end_level()
{
if ((level_result_ == NONE) || linger_)
if (level_result_ == NONE || linger_)
{
team &t = teams_[gui_->viewing_team()];
if (!browse_ && t.objectives_changed()) {
dialogs::show_objectives(level_, t.objectives());
t.reset_objectives_changed();
}
return;
}
throw end_level_exception(level_result_);
}