Made all the AI actions test for level end. (Fix for bug #14068.)

This commit is contained in:
Guillaume Melquiond 2009-08-05 06:39:23 +00:00
parent 86dce3e7cf
commit e8afe762ca
4 changed files with 7 additions and 2 deletions

View File

@ -42,7 +42,9 @@
#include "../log.hpp"
#include "../mouse_handler_base.hpp"
#include "../pathfind.hpp"
#include "play_controller.hpp"
#include "../replay.hpp"
#include "resources.hpp"
#include "../statistics.hpp"
#include "../team.hpp"
@ -90,6 +92,8 @@ void action_result::execute()
check_before();
if (is_success()){
do_execute();
check_victory();
resources::controller->check_end_level();
}
if (is_success()){
check_after();
@ -317,7 +321,6 @@ void attack_result::do_execute()
}
}
check_victory();
set_gamestate_changed();
//start of ugly hack. @todo 1.8 rework that via extended event system
//until event system is reworked, we note the attack this way

View File

@ -86,6 +86,7 @@ public:
int percentage = -1, bool add = false, bool bonus = true,
bool report = true, bool prescenario_save = true,
bool linger = true) = 0;
virtual void check_end_level() = 0;
//turn functions
size_t turn() const {return tod_manager_.turn();}

View File

@ -65,7 +65,7 @@ public:
virtual void force_end_level(LEVEL_RESULT res, const std::string &endlevel_music_list,
int percentage, bool add, bool bonus, bool report, bool prescenario_save,
bool linger);
void check_end_level();
virtual void check_end_level();
protected:
virtual void play_turn(bool no_save);

View File

@ -56,6 +56,7 @@ public:
, bool /*linger*/)
{
}
virtual void check_end_level() {}
std::vector<team> teams_start_;