The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ng::create_engine Class Reference

#include <create_engine.hpp>


struct  extras_metadata
struct  type_list

Public Types

enum  MP_EXTRA { ERA, MOD }
typedef std::shared_ptr
< extras_metadata
typedef std::shared_ptr< levellevel_ptr
typedef std::shared_ptr< scenarioscenario_ptr
typedef std::shared_ptr< user_mapuser_map_ptr
typedef std::shared_ptr
< random_map
typedef std::shared_ptr< campaigncampaign_ptr

Public Member Functions

 create_engine (saved_game &state)
void init_generated_level_data ()
void prepare_for_new_level ()
void prepare_for_era_and_mods ()
void prepare_for_scenario ()
void prepare_for_campaign (const std::string &difficulty="")
void prepare_for_saved_game ()
void prepare_for_other ()
std::string select_campaign_difficulty (int set_value=-1)
 select_campaign_difficulty More...
std::string get_selected_campaign_difficulty () const
void apply_level_filter (const std::string &name)
void apply_level_filter (int players)
void reset_level_filters ()
const std::string & level_name_filter () const
int player_num_filter () const
std::vector< level_ptrget_levels_by_type_unfiltered (level::TYPE type) const
std::vector< level_ptrget_levels_by_type (level::TYPE type) const
std::vector< size_t > get_filtered_level_indices (level::TYPE type) const
levelcurrent_level () const
const extras_metadatacurrent_era () const
void set_current_level_type (const level::TYPE type)
level::TYPE current_level_type () const
void set_current_level (const size_t index)
void set_current_era_index (const size_t index, bool force=false)
size_t current_era_index () const
const configcurent_era_cfg () const
const std::vector
< extras_metadata_ptr > & 
get_const_extras_by_type (const MP_EXTRA extra_type) const
< extras_metadata_ptr > & 
get_extras_by_type (const MP_EXTRA extra_type)
bool toggle_mod (int index, bool force=false)
bool generator_assigned () const
bool generator_has_settings () const
void generator_user_config ()
std::pair< level::TYPE, int > find_level_by_id (const std::string &id) const
int find_extra_by_id (const MP_EXTRA extra_type, const std::string &id) const
const depcheck::manager & dependency_manager () const
void init_active_mods ()
std::vector< std::string > & active_mods ()
std::vector< extras_metadata_ptractive_mods_data ()
const mp_game_settingsget_parameters ()
saved_gameget_state ()
bool current_level_has_side_data ()
 Returns true if the current level has one or more [side] tags. More...

Private Member Functions

 create_engine (const create_engine &)=delete
void operator= (const create_engine &)=delete
void init_all_levels ()
void init_extras (const MP_EXTRA extra_type)
void apply_level_filters ()
size_t map_level_index (size_t index) const

Private Attributes

level::TYPE current_level_type_
size_t current_level_index_
size_t current_era_index_
std::string level_name_filter_
int player_count_filter_
std::map< level::TYPE, type_listtype_map_
std::vector< std::string > user_map_names_
std::vector< std::string > user_scenario_names_
std::vector< extras_metadata_ptreras_
std::vector< extras_metadata_ptrmods_
< depcheck::manager > 
std::unique_ptr< map_generatorgenerator_
std::string selected_campaign_difficulty_
const configgame_config_
 Reference to the main game config. More...

Detailed Description

Definition at line 273 of file create_engine.hpp.

Member Typedef Documentation

typedef std::shared_ptr<campaign> ng::create_engine::campaign_ptr

Definition at line 294 of file create_engine.hpp.

Definition at line 288 of file create_engine.hpp.

typedef std::shared_ptr<level> ng::create_engine::level_ptr

Definition at line 290 of file create_engine.hpp.

Definition at line 293 of file create_engine.hpp.

typedef std::shared_ptr<scenario> ng::create_engine::scenario_ptr

Definition at line 291 of file create_engine.hpp.

typedef std::shared_ptr<user_map> ng::create_engine::user_map_ptr

Definition at line 292 of file create_engine.hpp.

Member Enumeration Documentation


Definition at line 278 of file create_engine.hpp.

Constructor & Destructor Documentation

ng::create_engine::create_engine ( saved_game state)
ng::create_engine::create_engine ( const create_engine )

Member Function Documentation

std::vector< std::string > & ng::create_engine::active_mods ( )
std::vector< create_engine::extras_metadata_ptr > ng::create_engine::active_mods_data ( )
void ng::create_engine::apply_level_filter ( const std::string &  name)
void ng::create_engine::apply_level_filter ( int  players)

Definition at line 496 of file create_engine.cpp.

References apply_level_filters(), and player_count_filter_.

void ng::create_engine::apply_level_filters ( )

Definition at line 787 of file create_engine.cpp.

References level_name_filter_, player_count_filter_, and type_map_.

Referenced by apply_level_filter().

const config & ng::create_engine::curent_era_cfg ( ) const
const create_engine::extras_metadata & ng::create_engine::current_era ( ) const
size_t ng::create_engine::current_era_index ( ) const

Definition at line 361 of file create_engine.hpp.

References current_era_index_.

Referenced by gui2::dialogs::mp_create_game::sync_with_depcheck().

level & ng::create_engine::current_level ( ) const
bool ng::create_engine::current_level_has_side_data ( )

Returns true if the current level has one or more [side] tags.

Definition at line 351 of file create_engine.cpp.

References current_level(), current_level_type_, ng::level::data(), and config::has_child().

Referenced by gui2::dialogs::mp_create_game::dialog_exit_hook().

level::TYPE ng::create_engine::current_level_type ( ) const
const depcheck::manager& ng::create_engine::dependency_manager ( ) const
int ng::create_engine::find_extra_by_id ( const MP_EXTRA  extra_type,
const std::string &  id 
) const

Definition at line 592 of file create_engine.cpp.

References get_const_extras_by_type(), and i.

Referenced by gui2::dialogs::mp_create_game::pre_show().

std::pair< level::TYPE, int > ng::create_engine::find_level_by_id ( const std::string &  id) const
bool ng::create_engine::generator_assigned ( ) const

Definition at line 560 of file create_engine.cpp.

References generator_.

Referenced by gui2::dialogs::mp_create_game::update_details().

bool ng::create_engine::generator_has_settings ( ) const

Definition at line 565 of file create_engine.cpp.

References generator_.

Referenced by gui2::dialogs::mp_create_game::update_details().

void ng::create_engine::generator_user_config ( )

Definition at line 570 of file create_engine.cpp.

References generator_.

Referenced by gui2::dialogs::mp_create_game::show_generator_settings().

const std::vector< create_engine::extras_metadata_ptr > & ng::create_engine::get_const_extras_by_type ( const MP_EXTRA  extra_type) const
std::vector< create_engine::extras_metadata_ptr > & ng::create_engine::get_extras_by_type ( const MP_EXTRA  extra_type)
std::vector< size_t > ng::create_engine::get_filtered_level_indices ( level::TYPE  type) const
std::vector< create_engine::level_ptr > ng::create_engine::get_levels_by_type ( level::TYPE  type) const

Definition at line 804 of file create_engine.cpp.

References type_map_.

std::vector< create_engine::level_ptr > ng::create_engine::get_levels_by_type_unfiltered ( level::TYPE  type) const
const mp_game_settings & ng::create_engine::get_parameters ( )
std::string ng::create_engine::get_selected_campaign_difficulty ( ) const

Definition at line 320 of file create_engine.hpp.

References selected_campaign_difficulty_.

saved_game & ng::create_engine::get_state ( )
void ng::create_engine::init_active_mods ( )
void ng::create_engine::init_all_levels ( )
void ng::create_engine::init_extras ( const MP_EXTRA  extra_type)
void ng::create_engine::init_generated_level_data ( )
const std::string& ng::create_engine::level_name_filter ( ) const

Definition at line 329 of file create_engine.hpp.

References level_name_filter_.

size_t ng::create_engine::map_level_index ( size_t  index) const
void ng::create_engine::operator= ( const create_engine )
int ng::create_engine::player_num_filter ( ) const

Definition at line 334 of file create_engine.hpp.

References player_count_filter_.

void ng::create_engine::prepare_for_campaign ( const std::string &  difficulty = "")
void ng::create_engine::prepare_for_era_and_mods ( )
void ng::create_engine::prepare_for_new_level ( )
void ng::create_engine::prepare_for_other ( )
void ng::create_engine::prepare_for_saved_game ( )
void ng::create_engine::prepare_for_scenario ( )
void ng::create_engine::reset_level_filters ( )

Definition at line 502 of file create_engine.cpp.

References level_name_filter_, and type_map_.

Referenced by create_engine().

std::string ng::create_engine::select_campaign_difficulty ( int  set_value = -1)


Launches difficulty selection gui and returns selected difficulty name.

The gui can be bypassed by supplying a number from 1 to the number of difficulties available, corresponding to a choice of difficulty. This is useful for specifying difficulty via command line.

set_valuePreselected difficulty number. The default -1 launches the gui.
Selected difficulty. Returns "FAIL" if set_value is invalid, and "CANCEL" if the gui is canceled.

Definition at line 421 of file create_engine.cpp.

References current_level(), d, selected_campaign_difficulty_, gui2::dialogs::campaign_difficulty::selected_difficulty(), gui2::dialogs::modal_dialog::show(), and utils::split().

Referenced by gui2::dialogs::mp_create_game::dialog_exit_hook(), and sp::enter_create_mode().

void ng::create_engine::set_current_era_index ( const size_t  index,
bool  force = false 
void ng::create_engine::set_current_level ( const size_t  index)
void ng::create_engine::set_current_level_type ( const level::TYPE  type)
bool ng::create_engine::toggle_mod ( int  index,
bool  force = false 

Member Data Documentation

size_t ng::create_engine::current_era_index_
size_t ng::create_engine::current_level_index_

Definition at line 408 of file create_engine.hpp.

Referenced by current_level(), and set_current_level().

level::TYPE ng::create_engine::current_level_type_
std::unique_ptr<depcheck::manager> ng::create_engine::dependency_manager_
std::vector<extras_metadata_ptr> ng::create_engine::eras_
const config& ng::create_engine::game_config_

Reference to the main game config.

Definition at line 460 of file create_engine.hpp.

Referenced by create_engine(), init_all_levels(), init_extras(), and prepare_for_era_and_mods().

std::unique_ptr<map_generator> ng::create_engine::generator_
std::string ng::create_engine::level_name_filter_
std::vector<extras_metadata_ptr> ng::create_engine::mods_

Definition at line 448 of file create_engine.hpp.

Referenced by get_const_extras_by_type(), and get_extras_by_type().

int ng::create_engine::player_count_filter_

Definition at line 413 of file create_engine.hpp.

Referenced by apply_level_filter(), apply_level_filters(), and player_num_filter().

std::string ng::create_engine::selected_campaign_difficulty_
saved_game& ng::create_engine::state_
std::map<level::TYPE, type_list> ng::create_engine::type_map_
std::vector<std::string> ng::create_engine::user_map_names_

Definition at line 444 of file create_engine.hpp.

Referenced by create_engine(), and init_all_levels().

std::vector<std::string> ng::create_engine::user_scenario_names_

Definition at line 445 of file create_engine.hpp.

Referenced by create_engine(), and init_all_levels().

The documentation for this class was generated from the following files: