Remove gamestate from ai::game_info, and uses resources::gamestate instead

This commit is contained in:
Ali El Gariani 2010-06-16 14:19:28 +00:00
parent 8160c13e3d
commit 2b89fee136
4 changed files with 6 additions and 10 deletions

View file

@ -252,7 +252,7 @@ bool ai_default_recruitment_stage::recruit_usage(const std::string& usage)
//FIXME: This message should be suppressed when WML author
//chooses the default recruitment pattern.
const std::string warning = "At difficulty level " +
get_info().game_state_.classification().difficulty + ", trying to recruit a:" +
resources::state_of_game->classification().difficulty + ", trying to recruit a:" +
usage + " but no unit of that type (usage=) is"
" available. Check the recruit and [ai]"
" recruitment_pattern keys for team '" +

View file

@ -120,14 +120,10 @@ typedef std::map<std::string, known_aspect_ptr > known_aspect_map;
class game_info {
public:
game_info(class game_state& game_state)
: game_state_(game_state)
, recent_attacks()
game_info()
: recent_attacks()
{}
/** The global game state, because we may set the completion field. */
class game_state& game_state_;
/** hack. @todo 1.9 rework that via extended event system, or at least ensure it hurts no one */
std::set<map_location> recent_attacks;
};

View file

@ -337,7 +337,7 @@ bool recruitment_phase::recruit_usage(const std::string& usage)
//FIXME: This message should be suppressed when WML author
//chooses the default recruitment pattern.
const std::string warning = "At difficulty level " +
get_info().game_state_.classification().difficulty + ", trying to recruit a:" +
resources::state_of_game->classification().difficulty + ", trying to recruit a:" +
usage + " but no unit of that type (usage=) is"
" available. Check the recruit and [ai]"
" recruitment_pattern keys for team '" +
@ -632,7 +632,7 @@ double move_leader_to_goals_phase::evaluate()
double max_risk = goal["max_risk"].to_double(1 - get_caution());
auto_remove_ = goal["auto_remove"].to_bool();
dst_ = map_location(goal, &get_info().game_state_);
dst_ = map_location(goal, resources::state_of_game);
if (!dst_.valid()) {
ERR_AI_TESTING_AI_DEFAULT << "Invalid goal: "<<std::endl<<goal;
return BAD_SCORE;

View file

@ -71,7 +71,7 @@ playsingle_controller::playsingle_controller(const config& level,
browse_ = linger_ = true;
}
ai::game_info ai_info(gamestate_);
ai::game_info ai_info;
ai::manager::set_ai_info(ai_info);
ai::manager::add_observer(this) ;
}