The Battle for Wesnoth  1.19.7+dev
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
game_config Namespace Reference

Game configuration data as global variables. More...

Namespaces

 colors
 
 images
 
 sounds
 

Classes

struct  optional_feature
 
class  scoped_preproc_define_internal
 Used to set and unset scoped defines to preproc_map. More...
 
class  config_cache
 Singleton class to manage game config file caching. More...
 
class  config_cache_transaction
 Used to share macros between cache objects You have to create transaction object to load all macros to memory and share them subsequent cache loads. More...
 
class  fake_transaction
 Holds a fake cache transaction if no real one is used. More...
 
struct  server_info
 

Typedefs

typedef scoped_preproc_define_internal< config_cachescoped_preproc_define
 

Enumerations

enum  LIBRARY_ID {
  LIB_BOOST , LIB_LUA , LIB_CRYPTO , LIB_CURL ,
  LIB_CAIRO , LIB_PANGO , LIB_SDL , LIB_SDL_IMAGE ,
  LIB_SDL_MIXER , LIB_COUNT
}
 

Functions

std::string build_arch ()
 Obtain the processor architecture for this build. More...
 
std::vector< optional_featureoptional_features_table (bool localize=true)
 Retrieve the features table. More...
 
const std::string & library_build_version (LIBRARY_ID lib)
 Retrieve the build-time version number of the given library. More...
 
const std::string & library_runtime_version (LIBRARY_ID lib)
 Retrieve the runtime version number of the given library. More...
 
const std::string & library_name (LIBRARY_ID lib)
 Retrieve the user-visible name for the given library. More...
 
std::string dist_channel_id ()
 Return the distribution channel identifier, or "Default" if missing. More...
 
std::string library_versions_report ()
 Produce a plain-text report of library versions suitable for stdout/stderr. More...
 
std::string optional_features_report ()
 Produce a plain-text report of features suitable for stdout/stderr. More...
 
std::string full_build_report ()
 Produce a bug report-style info dump. More...
 
void set_debug (bool new_debug)
 
static void add_color_info (const game_config_view &v, bool build_defaults)
 
void add_color_info (const game_config_view &v)
 
void load_config (const config &v)
 
void reset_color_info ()
 
const color_rangecolor_info (std::string_view name)
 
const std::vector< color_t > & tc_info (std::string_view name)
 
color_t red_to_green (double val, bool for_text=true)
 Return a color corresponding to the value val red for val=0.0 to green for val=100.0, passing by yellow. More...
 
color_t blue_to_white (double val, bool for_text)
 
std::string get_default_title_string ()
 
int kill_xp (int level)
 
int combat_xp (int level)
 

Variables

std::string path = ""
 
std::string default_preferences_path = ""
 
bool check_migration = false
 
const std::string observer_team_name = "observer"
 observer team name used for observer team chat More...
 
int cache_compression_level = 6
 
int base_income = 2
 
int village_income = 1
 
int village_support = 1
 
int recall_cost = 20
 
int kill_experience = 8
 
int combat_experience = 1
 
int poison_amount = 8
 
int rest_heal_amount = 2
 
const int gold_carryover_percentage = 80
 Default percentage gold carried over to the next scenario. More...
 
unsigned int tile_size = 72
 
std::string default_terrain
 
std::string shroud_prefix
 
std::string fog_prefix
 
std::string reach_map_prefix
 
std::vector< unsigned int > zoom_levels {36, 72, 144}
 
double hp_bar_scaling = 0.666
 
double xp_bar_scaling = 0.5
 
std::chrono::milliseconds lobby_network_timer = 100ms
 
std::chrono::milliseconds lobby_refresh = 4000ms
 
const std::size_t max_loop = 65536
 The maximum number of hexes on a map and items in an array and also used as maximum in wml loops. More...
 
std::vector< server_infoserver_list
 
bool allow_insecure = false
 
bool debug_impl = false
 
bool debug_lua = false
 
bool strict_lua = false
 
bool editor = false
 
bool ignore_replay_errors = false
 
bool mp_debug = false
 
bool exit_at_end = false
 
bool disable_autosave = false
 
bool no_addons = false
 
const bool & debug = debug_impl
 
bool show_ally_orb
 
bool show_disengaged_orb
 
bool show_enemy_orb
 
bool show_moved_orb
 
bool show_partial_orb
 
bool show_status_on_ally_orb
 
bool show_unmoved_orb
 
std::string title_music
 
std::string lobby_music
 
std::vector< std::string > default_defeat_music
 
std::vector< std::string > default_victory_music
 
std::string flag_rgb
 
std::string unit_rgb
 
std::vector< color_tred_green_scale
 
std::vector< color_tred_green_scale_text
 
std::vector< color_tblue_white_scale
 
std::vector< color_tblue_white_scale_text
 
std::map< std::string, color_range, std::less<> > team_rgb_range
 Colors defined by WML [color_range] tags. More...
 
std::map< std::string, t_string, std::less<> > team_rgb_name
 
std::map< std::string, std::vector< color_t >, std::less<> > team_rgb_colors
 
std::vector< std::string > default_colors
 
std::vector< std::string > foot_speed_prefix
 
std::string foot_teleport_enter
 
std::string foot_teleport_exit
 
const std::string default_title_string
 
const version_info wesnoth_version (VERSION)
 
const version_info min_savegame_version (MIN_SAVEGAME_VERSION)
 
const version_info test_version ("test")
 
const std::string revision = VERSION
 

Detailed Description

Game configuration data as global variables.

This module can be used to load various high level game configuration data from a .cfg file. The loaded data will subsequently be accessible via the global variables.

Typedef Documentation

◆ scoped_preproc_define

Definition at line 81 of file config_cache.hpp.

Enumeration Type Documentation

◆ LIBRARY_ID

Enumerator
LIB_BOOST 
LIB_LUA 
LIB_CRYPTO 
LIB_CURL 
LIB_CAIRO 
LIB_PANGO 
LIB_SDL 
LIB_SDL_IMAGE 
LIB_SDL_MIXER 
LIB_COUNT 

Definition at line 24 of file build_info.hpp.

Function Documentation

◆ add_color_info() [1/2]

void game_config::add_color_info ( const game_config_view v)

Definition at line 259 of file game_config.cpp.

◆ add_color_info() [2/2]

void game_config::add_color_info ( const game_config_view v,
bool  build_defaults 
)
static

◆ blue_to_white()

color_t game_config::blue_to_white ( double  val,
bool  for_text 
)

Definition at line 566 of file game_config.cpp.

References blue_white_scale, and blue_white_scale_text.

Referenced by unit_weapons().

◆ build_arch()

std::string game_config::build_arch ( )

Obtain the processor architecture for this build.

Definition at line 316 of file build_info.cpp.

References _().

Referenced by full_build_report(), gui2::dialogs::game_version::pre_show(), and process_command_args().

◆ color_info()

const color_range & game_config::color_info ( std::string_view  name)

◆ combat_xp()

int game_config::combat_xp ( int  level)
inline

◆ dist_channel_id()

std::string game_config::dist_channel_id ( )

Return the distribution channel identifier, or "Default" if missing.

Definition at line 396 of file build_info.cpp.

References lg::info(), path, and utils::trim().

Referenced by full_build_report().

◆ full_build_report()

std::string game_config::full_build_report ( )

◆ get_default_title_string()

std::string game_config::get_default_title_string ( )

◆ kill_xp()

int game_config::kill_xp ( int  level)
inline

◆ library_build_version()

const std::string & game_config::library_build_version ( LIBRARY_ID  lib)

Retrieve the build-time version number of the given library.

Definition at line 369 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::dialogs::game_version::game_version().

◆ library_name()

const std::string & game_config::library_name ( LIBRARY_ID  lib)

Retrieve the user-visible name for the given library.

Definition at line 387 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::dialogs::game_version::game_version().

◆ library_runtime_version()

const std::string & game_config::library_runtime_version ( LIBRARY_ID  lib)

Retrieve the runtime version number of the given library.

Definition at line 378 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::dialogs::game_version::game_version().

◆ library_versions_report()

std::string game_config::library_versions_report ( )

Produce a plain-text report of library versions suitable for stdout/stderr.

Definition at line 656 of file build_info.cpp.

Referenced by process_command_args().

◆ load_config()

void game_config::load_config ( const config v)

◆ optional_features_report()

std::string game_config::optional_features_report ( )

Produce a plain-text report of features suitable for stdout/stderr.

Definition at line 661 of file build_info.cpp.

Referenced by process_command_args().

◆ optional_features_table()

std::vector< optional_feature > game_config::optional_features_table ( bool  localize)

Retrieve the features table.

Definition at line 350 of file build_info.cpp.

References _().

◆ red_to_green()

color_t game_config::red_to_green ( double  val,
bool  for_text = true 
)

◆ reset_color_info()

void game_config::reset_color_info ( )

◆ set_debug()

void game_config::set_debug ( bool  new_debug)

◆ tc_info()

const std::vector< color_t > & game_config::tc_info ( std::string_view  name)

Variable Documentation

◆ allow_insecure

bool game_config::allow_insecure = false

Definition at line 78 of file game_config.cpp.

Referenced by process_command_args(), and addons_client::upload_addon().

◆ base_income

int game_config::base_income = 2

Definition at line 40 of file game_config.cpp.

Referenced by team::base_income(), load_config(), and team::set_base_income().

◆ blue_white_scale

std::vector< color_t > game_config::blue_white_scale

Definition at line 143 of file game_config.cpp.

Referenced by blue_to_white(), and wfl::builtins::DEFINE_WFL_FUNCTION().

◆ blue_white_scale_text

std::vector< color_t > game_config::blue_white_scale_text

Definition at line 144 of file game_config.cpp.

Referenced by blue_to_white(), and wfl::builtins::DEFINE_WFL_FUNCTION().

◆ cache_compression_level

int game_config::cache_compression_level = 6

Definition at line 103 of file filesystem.cpp.

Referenced by game_config::config_cache::write_file().

◆ check_migration

bool game_config::check_migration = false

Definition at line 99 of file filesystem.cpp.

Referenced by do_gameloop(), and filesystem::setup_user_data_dir().

◆ combat_experience

int game_config::combat_experience = 1

Definition at line 45 of file game_config.cpp.

Referenced by combat_xp(), and load_config().

◆ debug

const bool & game_config::debug = debug_impl

◆ debug_impl

bool game_config::debug_impl = false

Definition at line 84 of file game_config.cpp.

Referenced by set_debug().

◆ debug_lua

bool game_config::debug_lua = false

Definition at line 85 of file game_config.cpp.

Referenced by lua_kernel_base::intf_require(), and process_command_args().

◆ default_colors

std::vector< std::string > game_config::default_colors

Definition at line 152 of file game_config.cpp.

Referenced by add_color_info(), team::get_side_color_id(), and reset_color_info().

◆ default_defeat_music

std::vector< std::string > game_config::default_defeat_music

Definition at line 132 of file game_config.cpp.

Referenced by play_controller::select_music().

◆ default_preferences_path

std::string game_config::default_preferences_path = ""

Definition at line 97 of file filesystem.cpp.

Referenced by filesystem::get_default_prefs_file().

◆ default_terrain

std::string game_config::default_terrain

◆ default_title_string

const std::string game_config::default_title_string
extern

◆ default_victory_music

std::vector< std::string > game_config::default_victory_music

Definition at line 133 of file game_config.cpp.

Referenced by play_controller::select_music().

◆ disable_autosave

bool game_config::disable_autosave = false

◆ editor

bool game_config::editor = false

◆ exit_at_end

bool game_config::exit_at_end = false

Definition at line 90 of file game_config.cpp.

Referenced by playsingle_controller::do_end_level().

◆ flag_rgb

std::string game_config::flag_rgb

◆ fog_prefix

std::string game_config::fog_prefix

Definition at line 58 of file game_config.cpp.

Referenced by display::display(), and display::get_fog_shroud_images().

◆ foot_speed_prefix

std::vector< std::string > game_config::foot_speed_prefix

Definition at line 167 of file game_config.cpp.

Referenced by footsteps_images().

◆ foot_teleport_enter

std::string game_config::foot_teleport_enter

Definition at line 169 of file game_config.cpp.

Referenced by footsteps_images().

◆ foot_teleport_exit

std::string game_config::foot_teleport_exit

Definition at line 170 of file game_config.cpp.

Referenced by footsteps_images().

◆ gold_carryover_percentage

const int game_config::gold_carryover_percentage = 80

Default percentage gold carried over to the next scenario.

Definition at line 50 of file game_config.cpp.

Referenced by team::team_info::read().

◆ hp_bar_scaling

double game_config::hp_bar_scaling = 0.666

Definition at line 65 of file game_config.cpp.

Referenced by unit_type::build_full().

◆ ignore_replay_errors

bool game_config::ignore_replay_errors = false

◆ kill_experience

int game_config::kill_experience = 8

Definition at line 44 of file game_config.cpp.

Referenced by kill_xp(), load_config(), and unit::xp_color().

◆ lobby_music

std::string game_config::lobby_music

Definition at line 130 of file game_config.cpp.

◆ lobby_network_timer

std::chrono::milliseconds game_config::lobby_network_timer = 100ms

◆ lobby_refresh

std::chrono::milliseconds game_config::lobby_refresh = 4000ms

Definition at line 72 of file game_config.cpp.

Referenced by load_config(), and gui2::dialogs::mp_lobby::network_handler().

◆ max_loop

const std::size_t game_config::max_loop = 65536

The maximum number of hexes on a map and items in an array and also used as maximum in wml loops.

WARNING : This should not be set to less than the max map area

Definition at line 74 of file game_config.cpp.

Referenced by game_events::wml_event_pump::operator()(), and variable_info_implementation::parse_index().

◆ min_savegame_version

const version_info game_config::min_savegame_version ( MIN_SAVEGAME_VERSION  )

◆ mp_debug

bool game_config::mp_debug = false

◆ no_addons

bool game_config::no_addons = false

Definition at line 92 of file game_config.cpp.

Referenced by do_gameloop(), and game_config_manager::load_game_config().

◆ observer_team_name

const std::string game_config::observer_team_name = "observer"

observer team name used for observer team chat

Definition at line 101 of file filesystem.cpp.

Referenced by wesnothd::game::process_turn(), and events::menu_handler::send_chat_message().

◆ path

std::string game_config::path = ""

Definition at line 91 of file filesystem.cpp.

Referenced by schema_validation::schema_validator::active_tag_path(), ai::component_manager::add_component(), campaignd::add_license(), prefs::add_recent_files_entry(), add_status(), schema_validation::wml_tag::add_tag(), t_string::add_textdomain(), desktop::add_user_bookmark(), archive_dir(), archive_file(), filesystem::base_name(), BOOST_AUTO_TEST_CASE(), gui2::dialogs::game_version::browse_directory_callback(), image::build_spritesheet_from(), ai::component_manager::change_component(), gui2::dialogs::game_version::copy_to_clipboard_callback(), filesystem::create_directory_if_missing(), filesystem::create_directory_if_missing_recursive(), wb::manager::create_temp_move(), schema_validation::schema_self_validator::current_path(), ai::component_manager::delete_component(), filesystem::delete_directory(), filesystem::delete_file(), filesystem::dir_size(), filesystem::directory_name(), dist_channel_id(), unit_drawer::draw_ellipses(), gui2::dialogs::editor_edit_unit::editor_edit_unit(), editor::context_manager::expand_load_mru_menu(), filesystem::file_exists(), filesystem::file_modified_time(), filesystem::file_size(), ai::find_component(), filesystem::find_other_version_saves_dirs(), full_build_report(), test_utils::game_config_manager::game_config_manager(), game_launcher::game_launcher(), desktop::game_paths(), gui2::dialogs::game_version::game_version(), filesystem::get_addon_id_from_path(), filesystem::get_binary_dir_location(), filesystem::get_binary_file_location(), filesystem::get_binary_paths(), ai::component_manager::get_component(), ai::holder::get_component(), filesystem::get_core_images_dir(), filesystem::get_current_editor_dir(), filesystem::get_cwd(), filesystem::get_default_prefs_file(), filesystem::get_dir(), filesystem::get_exe_dir(), filesystem::get_exe_path(), filesystem::get_file_tree_checksum_internal(), filesystem::get_files_in_dir(), unit_race::get_icon_path_stem(), filesystem::get_independent_binary_file_path(), filesystem::get_intl_dir(), hotkey::command_executor::get_menu_image(), pathfind::paths::dest_vect::get_path(), filesystem::get_short_wml_path(), filesystem::get_wml_location(), gui2::dialogs::game_load::handle_dir_select(), handle_preprocess_command(), campaignd::server::handle_request_campaign_hash(), init_textdomains(), intf_modify_ai(), arrow::invalidate_arrow_path(), filesystem::is_bzip2_file(), filesystem::is_cfg(), filesystem::is_directory(), filesystem::is_gzip_file(), filesystem::is_legal_file(), filesystem::is_map(), filesystem::is_mask(), filesystem::is_path_sep(), filesystem::is_relative(), filesystem::is_root(), filesystem::istream_file(), campaignd::server::load_config(), game_config_manager::load_game_config(), gui::button::load_images(), luaW_getglobal(), main(), filesystem::make_directory(), filesystem::make_read_RWops(), filesystem::make_write_RWops(), font::manager::manager(), unit_display::move_unit(), filesystem::nearest_extant_parent(), filesystem::normalize_path(), filesystem::ostream_file(), wb::path_cost(), gui2::dialogs::campaign_selection::pre_show(), preprocess_string(), ai::component_manager::print_component_tree(), process_command_args(), purge_dir(), achievements::read_achievements_file(), achievements::reload(), ai::ai_default_rca::candidate_action_evaluation_loop::remove_completed_cas(), sound::music_track::resolve(), filesystem::root_name(), lg::rotate_logs(), run_campaignd(), game_lua_kernel::run_filter(), filesystem::sanitize_path(), editor::context_manager::save_map_as_dialog(), editor::context_manager::save_scenario_as_dialog(), gui2::dialogs::screenshot_notification::save_screenshot(), events::mouse_handler::select_hex(), gui2::dialogs::editor_edit_pbl::select_icon_file(), campaignd::server::server(), hotkey::command_executor_default::set_button_state(), filesystem::set_cwd(), prefs::set_mp_server_program_name(), arrow::set_path(), filesystem::binary_paths_manager::set_paths(), editor::mouse_action::set_terrain_mouse_overlay(), filesystem::set_user_data_dir(), gui2::dialogs::preferences_dialog::setup_hotkey_list(), events::menu_handler::show_enemy_moves(), gui2::dialogs::game_version::show_manual(), prefs::show_wesnothd_server_search(), filesystem::subtract_path(), schema_validation::schema_self_validator::tag_path_exists(), filesystem::to_asset_path(), editor::map_context::to_config(), unarchive_file(), gui2::dialogs::editor_edit_pbl::update_icon_preview(), arrow::valid_path(), wesnoth_global_fixture::wesnoth_global_fixture(), and game_events::WML_HANDLER_FUNCTION().

◆ poison_amount

int game_config::poison_amount = 8

◆ reach_map_prefix

std::string game_config::reach_map_prefix

Definition at line 58 of file game_config.cpp.

Referenced by game_display::get_reachmap_images().

◆ recall_cost

int game_config::recall_cost = 20

◆ red_green_scale

std::vector< color_t > game_config::red_green_scale

Definition at line 140 of file game_config.cpp.

Referenced by wfl::builtins::DEFINE_WFL_FUNCTION(), and red_to_green().

◆ red_green_scale_text

std::vector< color_t > game_config::red_green_scale_text

Definition at line 141 of file game_config.cpp.

Referenced by wfl::builtins::DEFINE_WFL_FUNCTION(), and red_to_green().

◆ rest_heal_amount

int game_config::rest_heal_amount = 2

Definition at line 48 of file game_config.cpp.

Referenced by calculate_healing(), and load_config().

◆ revision

const std::string game_config::revision = VERSION

◆ server_list

std::vector< server_info > game_config::server_list

Definition at line 76 of file game_config.cpp.

Referenced by prefs::builtin_servers_list(), and game_launcher::game_launcher().

◆ show_ally_orb

bool game_config::show_ally_orb

◆ show_disengaged_orb

bool game_config::show_disengaged_orb

◆ show_enemy_orb

bool game_config::show_enemy_orb

◆ show_moved_orb

bool game_config::show_moved_orb

◆ show_partial_orb

bool game_config::show_partial_orb

◆ show_status_on_ally_orb

bool game_config::show_status_on_ally_orb

◆ show_unmoved_orb

bool game_config::show_unmoved_orb

◆ shroud_prefix

std::string game_config::shroud_prefix

Definition at line 58 of file game_config.cpp.

Referenced by display::display(), and display::get_fog_shroud_images().

◆ strict_lua

bool game_config::strict_lua = false

Definition at line 86 of file game_config.cpp.

Referenced by process_command_args().

◆ team_rgb_colors

std::map< std::string, std::vector< color_t >, std::less<> > game_config::team_rgb_colors

◆ team_rgb_name

std::map< std::string, t_string, std::less<> > game_config::team_rgb_name

◆ team_rgb_range

std::map< std::string, color_range, std::less<> > game_config::team_rgb_range

Colors defined by WML [color_range] tags.

In addition to team colors such as "red" and "blue", this also contains the colors used on the minimap for "cave", "fungus" etc.

Definition at line 146 of file game_config.cpp.

Referenced by add_color_info(), color_info(), team::get_side_color_range(), impl_colors_table_dir(), image::prep_minimap_for_rendering(), and reset_color_info().

◆ test_version

const version_info game_config::test_version ( "test"  )

Definition at line 219 of file game_version.hpp.

Referenced by savegame::loadgame::check_version_compatibility().

◆ tile_size

unsigned int game_config::tile_size = 72

◆ title_music

std::string game_config::title_music

Definition at line 130 of file game_config.cpp.

Referenced by do_gameloop().

◆ unit_rgb

std::string game_config::unit_rgb

Definition at line 138 of file game_config.cpp.

Referenced by unit_type::flag_rgb(), and unit::flag_rgb().

◆ village_income

int game_config::village_income = 1

◆ village_support

int game_config::village_support = 1

◆ wesnoth_version

const version_info game_config::wesnoth_version ( VERSION  )

◆ xp_bar_scaling

double game_config::xp_bar_scaling = 0.5

Definition at line 66 of file game_config.cpp.

Referenced by unit_type::build_full().

◆ zoom_levels

std::vector< unsigned int > game_config::zoom_levels {36, 72, 144}

Definition at line 60 of file game_config.cpp.