The Battle for Wesnoth  1.19.7+dev
Macros | Functions | Variables
types.cpp File Reference

Handle unit-type specific attributes, animations, advancement. More...

#include "units/types.hpp"
#include "formula/callable_objects.hpp"
#include "game_config.hpp"
#include "game_errors.hpp"
#include "language.hpp"
#include "log.hpp"
#include "units/abilities.hpp"
#include "units/animation.hpp"
#include "units/unit.hpp"
#include "gui/auxiliary/typed_formula.hpp"
#include "gui/dialogs/loading_screen.hpp"
#include <boost/range/algorithm_ext/erase.hpp>
#include <array>
#include <locale>
Include dependency graph for types.cpp:

Go to the source code of this file.

Macros

#define ERR_CF   LOG_STREAM(err, log_config)
 
#define WRN_CF   LOG_STREAM(warn, log_config)
 
#define LOG_CONFIG   LOG_STREAM(info, log_config)
 
#define DBG_CF   LOG_STREAM(debug, log_config)
 
#define DBG_UT   LOG_STREAM(debug, log_unit)
 
#define LOG_UT   LOG_STREAM(info, log_unit)
 
#define ERR_UT   LOG_STREAM(err, log_unit)
 

Functions

static void append_special_note (std::vector< t_string > &notes, const t_string &new_note)
 
std::vector< t_stringcombine_special_notes (const std::vector< t_string > &direct, const config &abilities, const const_attack_itors &attacks, const movetype &mt)
 Common logic for unit_type::special_notes() and unit::special_notes(). More...
 
static void advancement_tree_internal (const std::string &id, std::set< std::string > &tree)
 
void adjust_profile (std::string &profile)
 

Variables

static lg::log_domain log_config ("config")
 
static lg::log_domain log_unit ("unit")
 
unit_type_data unit_types
 

Detailed Description

Handle unit-type specific attributes, animations, advancement.

Definition in file types.cpp.

Macro Definition Documentation

◆ DBG_CF

#define DBG_CF   LOG_STREAM(debug, log_config)

Definition at line 44 of file types.cpp.

◆ DBG_UT

#define DBG_UT   LOG_STREAM(debug, log_unit)

Definition at line 47 of file types.cpp.

◆ ERR_CF

#define ERR_CF   LOG_STREAM(err, log_config)

Definition at line 41 of file types.cpp.

◆ ERR_UT

#define ERR_UT   LOG_STREAM(err, log_unit)

Definition at line 49 of file types.cpp.

◆ LOG_CONFIG

#define LOG_CONFIG   LOG_STREAM(info, log_config)

Definition at line 43 of file types.cpp.

◆ LOG_UT

#define LOG_UT   LOG_STREAM(info, log_unit)

Definition at line 48 of file types.cpp.

◆ WRN_CF

#define WRN_CF   LOG_STREAM(warn, log_config)

Definition at line 42 of file types.cpp.

Function Documentation

◆ adjust_profile()

void adjust_profile ( std::string &  profile)

Definition at line 1502 of file types.cpp.

References image::exists().

Referenced by unit_type::build_help_index(), and unit::set_big_profile().

◆ advancement_tree_internal()

static void advancement_tree_internal ( const std::string &  id,
std::set< std::string > &  tree 
)
static

Definition at line 632 of file types.cpp.

References unit_type::advances_to(), unit_type_data::find(), and unit_types.

Referenced by unit_type::advancement_tree().

◆ append_special_note()

static void append_special_note ( std::vector< t_string > &  notes,
const t_string new_note 
)
static

Definition at line 499 of file types.cpp.

References t_string::c_str(), t_string::empty(), utils::find(), and utils::trim().

Referenced by combine_special_notes().

◆ combine_special_notes()

std::vector<t_string> combine_special_notes ( const std::vector< t_string > &  direct,
const config abilities,
const const_attack_itors attacks,
const movetype mt 
)

Common logic for unit_type::special_notes() and unit::special_notes().

Adds any notes from the sources given as arguments, and filters out duplicates.

Returns
the special notes for a unit or unit_type.

Definition at line 509 of file types.cpp.

References config::all_children_view(), append_special_note(), unit_type::attacks(), symbol_table::end(), symbol_table::find(), movetype::special_notes(), and string_table.

Referenced by unit_type::special_notes(), and unit::unit_special_notes().

Variable Documentation

◆ log_config

lg::log_domain log_config("config") ( "config"  )
static

◆ log_unit

lg::log_domain log_unit("unit") ( "unit"  )
static

◆ unit_types

unit_type_data unit_types

Definition at line 1500 of file types.cpp.

Referenced by advancement_tree_internal(), unit_type::advances_from(), unit::advances_to_translated(), unit::apply_builtin_effect(), unit_type::apply_scenario_fix(), BOOST_AUTO_TEST_CASE(), events::menu_handler::can_recruit(), ai::default_recruitment::recruitment::compare_unit_types(), wb::recruit::create_corresponding_unit(), wfl::gamestate::DEFINE_WFL_FUNCTION(), ai::default_recruitment::recruitment::do_combat_analysis(), events::console_handler::do_create(), events::console_handler::do_discover(), ai::recruit_result::do_execute(), ai::default_recruitment::recruitment::do_similarity_penalty(), ai::default_recruitment::recruitment::execute(), unit_filter_impl::unit_filter_compound::fill(), ng::flg_manager::flg_manager(), test_utils::game_config_manager::game_config_manager(), help::generate_ability_topics(), help::generate_faction_topics(), help::generate_races_sections(), gui2::dialogs::mp_join_game::generate_side_list(), help::generate_trait_topics(), help::generate_unit_sections(), help::generate_unit_topics(), help::generate_weapon_special_topics(), get_advanced_unit(), ai::default_recruitment::recruitment::get_average_defense(), ai::default_recruitment::recruitment::get_cheapest_unit_cost_for_leader(), ai::default_recruitment::recruitment::get_cost_map_of_side(), actions::undo::get_unit_type(), get_unit_type(), ai::recruit_result::get_unit_type_known(), ai::formula_ai::get_value(), ai::helper_advance_unit(), unit_type::hide_help(), impl_race_get(), impl_unit_type_count(), impl_unit_type_list(), impl_unit_type_lookup(), impl_unit_type_next(), unit::init(), help::init_help(), intf_add_known_unit(), game_lua_kernel::intf_find_cost_map(), intf_transform_unit(), gui2::dialogs::editor_edit_unit::load_unit_type(), luaW_checkrace(), luaW_pushracetable(), help::make_unit_link(), team::minimum_recruit_price(), gui2::dialogs::faction_select::on_faction_select(), gui2::dialogs::faction_select::on_leader_select(), gui2::dialogs::statistics_dialog::on_primary_list_select(), help::unit_topic_generator::operator()(), play_controller::play_controller(), gui2::dialogs::editor_edit_unit::pre_show(), gui2::dialogs::unit_create::pre_show(), gui2::dialogs::faction_select::profile_button_callback(), ai::default_recruitment::recruitment::recall_unit_value(), wb::recruit::recruit(), events::menu_handler::recruit(), ai::default_recruitment::recruitment::recruit_matches_type(), ng::flg_manager::resolve_random(), unit::set_advances_to(), unit::set_recruits(), game_config_manager::set_unit_data(), editor::unit_palette::setup(), help::show_unit_description(), statistics_t::sum_cost_str_int_map(), SYNCED_COMMAND_HANDLER_FUNCTION(), gui2::dialogs::tally(), editor::mouse_action_unit::up_left(), ng::flg_manager::update_available_genders(), ai::default_recruitment::recruitment::update_average_local_cost(), gui2::dialogs::mp_staging::update_leader_display(), gui2::dialogs::faction_select::update_leader_image(), and play_controller::~play_controller().