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>

Classes

struct  extras_metadata
 
struct  type_list
 

Public Types

enum  MP_EXTRA { ERA, MOD }
 
typedef std::shared_ptr
< extras_metadata
extras_metadata_ptr
 
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
random_map_ptr
 
typedef std::shared_ptr< campaigncampaign_ptr
 

Public Member Functions

 create_engine (CVideo &v, 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_extra (const MP_EXTRA extra_type) 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)
 
void set_current_mod_index (const size_t index)
 
size_t current_era_index () const
 
size_t current_mod_index () const
 
const configcurent_era_cfg () const
 
const std::vector
< extras_metadata_ptr > & 
get_const_extras_by_type (const MP_EXTRA extra_type) const
 
std::vector
< extras_metadata_ptr > & 
get_extras_by_type (const MP_EXTRA extra_type)
 
bool toggle_current_mod (bool force=false)
 
bool generator_assigned () const
 
bool generator_has_settings () const
 
void generator_user_config ()
 
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
 
level::TYPE find_level_type_by_id (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_
 
size_t current_mod_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_
 
saved_gamestate_
 
CVideovideo_
 
std::unique_ptr
< depcheck::manager > 
dependency_manager_
 
std::unique_ptr< map_generatorgenerator_
 
std::string selected_campaign_difficulty_
 

Detailed Description

Definition at line 274 of file create_engine.hpp.

Member Typedef Documentation

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

Definition at line 295 of file create_engine.hpp.

Definition at line 289 of file create_engine.hpp.

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

Definition at line 291 of file create_engine.hpp.

Definition at line 294 of file create_engine.hpp.

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

Definition at line 292 of file create_engine.hpp.

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

Definition at line 293 of file create_engine.hpp.

Member Enumeration Documentation

Enumerator
ERA 
MOD 

Definition at line 279 of file create_engine.hpp.

Constructor & Destructor Documentation

ng::create_engine::create_engine ( CVideo v,
saved_game state 
)
ng::create_engine::create_engine ( const create_engine )
privatedelete

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 490 of file create_engine.cpp.

References apply_level_filters(), and player_count_filter_.

void ng::create_engine::apply_level_filters ( )
private

Definition at line 797 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
size_t ng::create_engine::current_era_index ( ) const
inline

Definition at line 366 of file create_engine.hpp.

References current_era_index_.

const create_engine::extras_metadata & ng::create_engine::current_extra ( const MP_EXTRA  extra_type) const
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 355 of file create_engine.cpp.

References current_level(), 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
inline
size_t ng::create_engine::current_mod_index ( ) const
inline

Definition at line 371 of file create_engine.hpp.

References current_mod_index_.

const depcheck::manager& ng::create_engine::dependency_manager ( ) const
inline

Definition at line 391 of file create_engine.hpp.

References dependency_manager_.

int ng::create_engine::find_extra_by_id ( const MP_EXTRA  extra_type,
const std::string &  id 
) const

Definition at line 596 of file create_engine.cpp.

References get_const_extras_by_type(), and i.

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

int ng::create_engine::find_level_by_id ( const std::string &  id) const
level::TYPE ng::create_engine::find_level_type_by_id ( const std::string &  id) const

Definition at line 609 of file create_engine.cpp.

References type_map_.

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

bool ng::create_engine::generator_assigned ( ) const

Definition at line 562 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 567 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 572 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)

Definition at line 838 of file create_engine.cpp.

References ERA, eras_, and mods_.

Referenced by init_extras(), and gui2::dialogs::mp_create_game::pre_show().

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 814 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
inline

Definition at line 321 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 ( )
private
void ng::create_engine::init_extras ( const MP_EXTRA  extra_type)
private
void ng::create_engine::init_generated_level_data ( )
const std::string& ng::create_engine::level_name_filter ( ) const
inline

Definition at line 330 of file create_engine.hpp.

References level_name_filter_.

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

Definition at line 335 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 496 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)

select_campaign_difficulty

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.

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

Definition at line 415 of file create_engine.cpp.

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

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)
inline
void ng::create_engine::set_current_mod_index ( const size_t  index)
inline
bool ng::create_engine::toggle_current_mod ( bool  force = false)

Member Data Documentation

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

Definition at line 419 of file create_engine.hpp.

Referenced by current_level(), and set_current_level().

level::TYPE ng::create_engine::current_level_type_
private
size_t ng::create_engine::current_mod_index_
private
std::unique_ptr<depcheck::manager> ng::create_engine::dependency_manager_
private
std::vector<extras_metadata_ptr> ng::create_engine::eras_
private
std::unique_ptr<map_generator> ng::create_engine::generator_
private
std::string ng::create_engine::level_name_filter_
private
std::vector<extras_metadata_ptr> ng::create_engine::mods_
private

Definition at line 460 of file create_engine.hpp.

Referenced by get_const_extras_by_type(), and get_extras_by_type().

int ng::create_engine::player_count_filter_
private

Definition at line 425 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_
private
saved_game& ng::create_engine::state_
private
std::map<level::TYPE, type_list> ng::create_engine::type_map_
private
std::vector<std::string> ng::create_engine::user_map_names_
private

Definition at line 456 of file create_engine.hpp.

Referenced by create_engine(), and init_all_levels().

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

Definition at line 457 of file create_engine.hpp.

Referenced by create_engine(), and init_all_levels().

CVideo& ng::create_engine::video_
private

Definition at line 464 of file create_engine.hpp.

Referenced by create_engine(), and select_campaign_difficulty().


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