Configure Engine: remove entry point code
This is now handled by the MP Create Game dialog in post-show. Since that dialog creates a new instance of this class each time a game is selected, this should be a small optimization. I might move the entry point setting as a whole back to this class later.
This commit is contained in:
parent
4ee61013ed
commit
2df3a09c0c
2 changed files with 0 additions and 43 deletions
|
@ -29,22 +29,7 @@ configure_engine::configure_engine(saved_game& state, const config* intial)
|
||||||
, parameters_(state_.mp_settings())
|
, parameters_(state_.mp_settings())
|
||||||
, initial_(intial ? intial : &state_.get_starting_pos())
|
, initial_(intial ? intial : &state_.get_starting_pos())
|
||||||
{
|
{
|
||||||
|
|
||||||
set_use_map_settings(use_map_settings_default());
|
set_use_map_settings(use_map_settings_default());
|
||||||
if(state_.classification().get_tagname() == "scenario") {
|
|
||||||
for (const config& scenario :
|
|
||||||
game_config_manager::get()->game_config().child_range(state_.classification().get_tagname())) {
|
|
||||||
|
|
||||||
if (scenario["allow_new_game"].to_bool(true) || game_config::debug) {
|
|
||||||
|
|
||||||
const std::string& title = (!scenario["new_game_title"].empty()) ?
|
|
||||||
scenario["new_game_title"] : scenario["name"];
|
|
||||||
|
|
||||||
entry_points_.push_back(&scenario);
|
|
||||||
entry_point_titles_.push_back(title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure_engine::set_default_values() {
|
void configure_engine::set_default_values() {
|
||||||
|
@ -110,23 +95,6 @@ void configure_engine::set_shuffle_sides(bool val) { parameters_.shuffle_sides =
|
||||||
void configure_engine::set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val) { parameters_.random_faction_mode = val;}
|
void configure_engine::set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val) { parameters_.random_faction_mode = val;}
|
||||||
void configure_engine::set_options(const config& cfg) { parameters_.options = cfg; }
|
void configure_engine::set_options(const config& cfg) { parameters_.options = cfg; }
|
||||||
|
|
||||||
void configure_engine::set_scenario(size_t scenario_num) {
|
|
||||||
const config& scenario = *entry_points_[scenario_num];
|
|
||||||
|
|
||||||
parameters_.hash = scenario.hash();
|
|
||||||
state_.set_scenario(scenario);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool configure_engine::set_scenario(std::string& scenario_id) {
|
|
||||||
for (size_t i = 0; i < entry_points_.size(); ++i) {
|
|
||||||
if ((**(entry_points_.begin() + i))["id"] == scenario_id) {
|
|
||||||
set_scenario(i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string configure_engine::game_name_default() const {
|
std::string configure_engine::game_name_default() const {
|
||||||
utils::string_map i18n_symbols;
|
utils::string_map i18n_symbols;
|
||||||
i18n_symbols["login"] = preferences::login();
|
i18n_symbols["login"] = preferences::login();
|
||||||
|
@ -207,10 +175,6 @@ const mp_game_settings& configure_engine::get_parameters() const {
|
||||||
return parameters_;
|
return parameters_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& configure_engine::entry_point_titles() const {
|
|
||||||
return entry_point_titles_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void configure_engine::write_parameters()
|
void configure_engine::write_parameters()
|
||||||
{
|
{
|
||||||
config& scenario = this->state_.get_starting_pos();
|
config& scenario = this->state_.get_starting_pos();
|
||||||
|
|
|
@ -83,9 +83,6 @@ public:
|
||||||
void set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val);
|
void set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val);
|
||||||
void set_options(const config& cfg);
|
void set_options(const config& cfg);
|
||||||
|
|
||||||
void set_scenario(size_t scenario_num);
|
|
||||||
bool set_scenario(std::string& scenario_id);
|
|
||||||
|
|
||||||
// parameter defaults
|
// parameter defaults
|
||||||
std::string game_name_default() const;
|
std::string game_name_default() const;
|
||||||
int num_turns_default() const;
|
int num_turns_default() const;
|
||||||
|
@ -137,10 +134,6 @@ private:
|
||||||
{
|
{
|
||||||
return *initial_;
|
return *initial_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const config*> entry_points_;
|
|
||||||
|
|
||||||
std::vector<std::string> entry_point_titles_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace ng
|
} // end namespace ng
|
||||||
|
|
Loading…
Add table
Reference in a new issue