mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-13 20:00:24 +00:00
made Formula AI object persistant
Other AI types remain unchanged, with the exception they now use a boost::shared_ptr instead of util::scoped_ptr
This commit is contained in:
parent
c30816633f
commit
ba13c23261
@ -21,6 +21,7 @@
|
||||
#include "playsingle_controller.hpp"
|
||||
|
||||
#include "construct_dialog.hpp"
|
||||
#include "ai.hpp"
|
||||
#include "ai_interface.hpp"
|
||||
#include "game_errors.hpp"
|
||||
#include "gettext.hpp"
|
||||
@ -704,7 +705,12 @@ void playsingle_controller::play_ai_turn(){
|
||||
map_, teams_, player_number_, units_, replay_sender_, undo_stack_);
|
||||
|
||||
ai_interface::info ai_info(*gui_,map_,units_,teams_,player_number_,status_, turn_data, gamestate_);
|
||||
util::scoped_ptr<ai_interface> ai_obj(create_ai(current_team().ai_algorithm(),ai_info));
|
||||
std::string ai_algorithm = current_team().ai_algorithm();
|
||||
|
||||
boost::shared_ptr<ai_interface> ai_obj(ai_algorithm == "formula_ai" ?
|
||||
ai_manager::get_ai(ai_info,current_team().name(),ai_algorithm) :
|
||||
boost::shared_ptr<ai_interface> (create_ai(ai_algorithm,ai_info)));
|
||||
|
||||
ai_obj->user_interact().attach_handler(this);
|
||||
ai_obj->unit_recruited().attach_handler(this);
|
||||
ai_obj->unit_moved().attach_handler(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user