38 if(str2.size() > str1.size()) {
42 for(std::size_t
i = 0;
i < str1.size() - str2.size() + 1;
i++) {
44 for(std::size_t j = 0; j < str2.size(); j++) {
45 if(std::tolower(str1[
i + j]) != std::tolower(str2[j])) {
71 virtual std::string
id()
const
76 virtual std::string
name()
const
81 virtual std::string
icon()
const
88 return data_[
"description"];
93 return data_[
"allow_era_choice"].to_bool(
true);
162 std::string
id()
const
224 std::string
id()
const
246 return min_players_ <= player_count && max_players_ >= player_count;
249 std::pair<utils::irdya_date, utils::irdya_date>
dates()
const
263 std::pair<utils::irdya_date, utils::irdya_date>
dates_;
370 bool toggle_mod(
const std::string&
id,
bool force =
false);
376 std::pair<level_type::type, int>
find_level_by_id(
const std::string&
id)
const;
421 void apply_filter(
const int player_count,
const std::string& name_filter)
425 for(std::size_t
i = 0;
i <
games.size();
i++) {
426 const bool num_players_match = player_count == 1 ||
games[
i]->player_count_filter(player_count);
446 std::vector<extras_metadata_ptr>
eras_;
447 std::vector<extras_metadata_ptr>
mods_;
A config object defines a single node in a WML file, with access to child nodes.
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Encapsulates the map of the game.
campaign(const campaign &)=delete
std::pair< utils::irdya_date, utils::irdya_date > dates_
campaign(const config &data)
bool player_count_filter(int player_count) const
std::pair< utils::irdya_date, utils::irdya_date > dates() const
bool can_launch_game() const
campaign & operator=(const campaign &)=delete
bool allow_era_choice() const
std::string level_name_filter_
int find_extra_by_id(const MP_EXTRA extra_type, const std::string &id) const
std::string get_selected_campaign_difficulty() const
void reset_level_filters()
create_engine(saved_game &state)
std::shared_ptr< campaign > campaign_ptr
std::vector< std::size_t > get_filtered_level_indices(level_type::type type) const
bool toggle_mod(const std::string &id, bool force=false)
const std::string & level_name_filter() const
void set_current_era_index(const std::size_t index, bool force=false)
std::string select_campaign_difficulty(int set_value=-1)
select_campaign_difficulty
std::vector< level_ptr > get_levels_by_type(level_type::type type) const
std::string selected_campaign_difficulty_
bool generator_has_settings() const
std::vector< std::string > & active_mods()
std::vector< std::string > user_map_names_
bool current_level_has_side_data()
Returns true if the current level has one or more [side] tags.
bool generator_assigned() const
level_type::type current_level_type() const
std::map< level_type::type, type_list > type_map_
void init_extras(const MP_EXTRA extra_type)
int player_num_filter() const
std::vector< extras_metadata_ptr > & get_extras_by_type(const MP_EXTRA extra_type)
std::shared_ptr< user_map > user_map_ptr
const std::vector< extras_metadata_ptr > & get_const_extras_by_type(const MP_EXTRA extra_type) const
void apply_level_filter(const std::string &name)
void prepare_for_new_level()
const depcheck::manager & dependency_manager() const
const extras_metadata & current_era() const
create_engine & operator=(const create_engine &)=delete
std::size_t current_era_index_
const config & curent_era_cfg() const
std::vector< extras_metadata_ptr > mods_
std::unique_ptr< depcheck::manager > dependency_manager_
std::vector< std::string > user_scenario_names_
std::vector< extras_metadata_ptr > active_mods_data()
std::shared_ptr< level > level_ptr
void apply_level_filters()
void set_current_level_type(const level_type::type type)
const game_config_view & game_config_
Reference to the main game config.
std::shared_ptr< random_map > random_map_ptr
std::unique_ptr< map_generator > generator_
std::pair< level_type::type, int > find_level_by_id(const std::string &id) const
bool is_campaign() const
Wrapper to simplify the is-type-campaign-or-sp-campaign check.
std::vector< extras_metadata_ptr > eras_
void prepare_for_campaign(const std::string &difficulty="")
std::vector< level_ptr > get_levels_by_type_unfiltered(level_type::type type) const
const mp_game_settings & get_parameters()
std::shared_ptr< extras_metadata > extras_metadata_ptr
void prepare_for_saved_game()
void set_current_level(const std::size_t index)
std::size_t map_level_index(std::size_t index) const
void generator_user_config()
void prepare_for_era_and_mods()
std::size_t current_era_index() const
void init_generated_level_data()
level_type::type current_level_type_
void prepare_for_scenario()
std::size_t current_level_index_
create_engine(const create_engine &)=delete
level & current_level() const
std::shared_ptr< scenario > scenario_ptr
Note to all triers: It's not guaranteed that the specified component will be selected (if the user de...
Base class for all level type classes.
const config & data() const
virtual bool player_count_filter(int player_count) const =0
level & operator=(const level &)=delete
virtual bool can_launch_game() const =0
void set_data(const config &data)
level(const level &)=delete
virtual std::string id() const
virtual std::string name() const
virtual void set_metadata()=0
virtual bool allow_era_choice() const
virtual std::string icon() const
virtual std::string description() const
level(const config &data)
bool generate_whole_scenario() const
bool generate_whole_scenario_
const config & generator_data() const
random_map & operator=(const random_map &)=delete
random_map(const config &data)
random_map(const random_map &)=delete
std::string generator_name() const
map_generator * create_map_generator() const
std::string generator_name_
scenario & operator=(const scenario &)=delete
std::unique_ptr< gamemap > map_
scenario(const config &data)
bool player_count_filter(int player_count) const
scenario(const scenario &)=delete
std::string map_size() const
bool can_launch_game() const
std::string id() const
For user maps, the id and name are the same.
user_map & operator=(const user_map &)=delete
user_map(const config &data, const std::string &name, gamemap *map)
std::string description() const
user_map(const user_map &)=delete
Definitions for the interface to Wesnoth Markup Language (WML).
static bool contains_ignore_case(const std::string &str1, const std::string &str2)
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::vector< std::size_t > games_filtered
std::vector< level_ptr > games
void apply_filter(const int player_count, const std::string &name_filter)