Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Sep 12, 2014
2 parents 30322ff + 0e6a693 commit 9d2ffb9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/ai/testing/stage_sf_with_rca.hpp
Expand Up @@ -41,38 +41,6 @@ namespace testing_ai_default {
class turn_state;
class decision;

class strategy_formulation_with_rca: public virtual stage, public virtual rca_context {
public:
strategy_formulation_with_rca(ai_context &context, const config &cfg);

~strategy_formulation_with_rca();

bool do_play_stage();

void on_create();

config to_config() const;

rca_context& get_rca_context();

void simulate_states_ahead();

void set_optimal_strategy();

const turn_state simulate_state(const int decision_no_, const turn_state &state);

void switch_side();

void init_side();

private:
std::queue<turn_state> states_;

std::vector<bool> enemy_this_turn_; // Store if is enemy for this turn. Use in the set optimal strategy function.

boost::shared_ptr<candidate_action_evaluation_loop> rca_;
};

class decision
{
friend std::ostream& operator<<(std::ostream&, const decision&);
Expand Down Expand Up @@ -133,6 +101,38 @@ class turn_state
decision decision_;
};

class strategy_formulation_with_rca: public virtual stage, public virtual rca_context {
public:
strategy_formulation_with_rca(ai_context &context, const config &cfg);

~strategy_formulation_with_rca();

bool do_play_stage();

void on_create();

config to_config() const;

rca_context& get_rca_context();

void simulate_states_ahead();

void set_optimal_strategy();

const turn_state simulate_state(const int decision_no_, const turn_state &state);

void switch_side();

void init_side();

private:
std::queue<turn_state> states_;

std::vector<bool> enemy_this_turn_; // Store if is enemy for this turn. Use in the set optimal strategy function.

boost::shared_ptr<candidate_action_evaluation_loop> rca_;
};

} // of namespace testing_ai_default

} // of namespace ai
Expand Down
7 changes: 7 additions & 0 deletions src/singleplayer.cpp
Expand Up @@ -81,6 +81,7 @@ bool enter_create_mode(game_display& disp, const config& game_config,
// didn't find any campaign with that id
if (not_found)
{
//TODO: use ERR_NG or similar
std::cerr<<"No such campaign id to jump to: ["<<jump_to_campaign.campaign_id_<<"]\n";
return false;
}
Expand All @@ -107,6 +108,12 @@ bool enter_create_mode(game_display& disp, const config& game_config,
create_eng.prepare_for_new_level();

create_eng.get_parameters();
if(!state.valid())
{
//TODO: use ERR_NG or similar
std::cerr << "Cannot load scenario with id=" << state.get_scenario_id() << "\n";
return false;
}

configure_canceled = !enter_configure_mode(disp, resources::config_manager->game_config(),
state, jump_to_campaign, local_players_only);
Expand Down

0 comments on commit 9d2ffb9

Please sign in to comment.