The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
game_config Namespace Reference

Game configuration data as global variables. More...

Namespaces

 colors
 
 images
 
 sounds
 

Classes

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  optional_feature
 
class  scoped_preproc_define_internal
 Used to set and unset scoped defines to preproc_map. More...
 
struct  server_info
 

Typedefs

typedef
scoped_preproc_define_internal
< config_cache
scoped_preproc_define
 

Enumerations

enum  LIBRARY_ID {
  LIB_BOOST, LIB_CRYPTO, LIB_CAIRO, LIB_PANGO,
  LIB_SDL, LIB_SDL_IMAGE, LIB_SDL_MIXER, LIB_SDL_TTF,
  LIB_PNG, LIB_COUNT
}
 

Functions

std::vector< optional_featureoptional_features_table ()
 Return a localized 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 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...
 
static void add_color_info (const config &v, bool build_defaults)
 
void add_color_info (const config &v)
 
void load_config (const config &v)
 
void reset_color_info ()
 
const color_rangecolor_info (const std::string &name)
 
const std::vector< color_t > & tc_info (const std::string &name)
 
color_t red_to_green (int val, bool for_text=true)
 Return a color corresponding to the value val red for val=0 to green for val=100, passing by yellow. More...
 
color_t blue_to_white (int val, bool for_text)
 
std::string get_default_title_string ()
 
int kill_xp (int level)
 

Variables

const std::string version = VERSION
 
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
 
std::string path = ""
 
std::string default_preferences_path = ""
 
std::string wesnoth_program_dir
 
int base_income = 2
 
int village_income = 1
 
int village_support = 1
 
int recall_cost = 20
 
int kill_experience = 8
 
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::vector< unsigned int > zoom_levels {36, 72, 144}
 
double hp_bar_scaling = 0.666
 
double xp_bar_scaling = 0.5
 
double hex_brightening = 1.25
 
int cache_compression_level = 6
 
unsigned lobby_network_timer = 100
 
unsigned lobby_refresh = 4000
 
const std::string observer_team_name = "observer"
 observer team name used for observer team chat More...
 
const 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 debug = false
 
bool debug_lua = false
 
bool editor = false
 
bool ignore_replay_errors = false
 
bool mp_debug = false
 
bool exit_at_end = false
 
bool no_delay = false
 
bool disable_autosave = false
 
bool no_addons = false
 
bool show_ally_orb
 
bool show_enemy_orb
 
bool show_moved_orb
 
bool show_partial_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
 
static std::vector< color_tblue_white_scale
 
static std::vector< color_tblue_white_scale_text
 
std::map< std::string,
color_range
team_rgb_range
 
std::map< std::string, t_stringteam_rgb_name
 
std::map< std::string,
std::vector< color_t > > 
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
 
double hex_semi_brightening
 

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

Definition at line 78 of file config_cache.hpp.

Enumeration Type Documentation

Enumerator
LIB_BOOST 
LIB_CRYPTO 
LIB_CAIRO 
LIB_PANGO 
LIB_SDL 
LIB_SDL_IMAGE 
LIB_SDL_MIXER 
LIB_SDL_TTF 
LIB_PNG 
LIB_COUNT 

Definition at line 23 of file build_info.hpp.

Function Documentation

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

Definition at line 264 of file game_config.cpp.

References add_color_info().

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

Definition at line 550 of file game_config.cpp.

References blue_white_scale, and utils::clamp().

Referenced by unit_weapons().

const color_range & game_config::color_info ( const std::string &  name)
std::string game_config::full_build_report ( )
std::string game_config::get_default_title_string ( )
int game_config::kill_xp ( int  level)
inline
const std::string & game_config::library_build_version ( LIBRARY_ID  lib)

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

Definition at line 342 of file build_info.cpp.

References LIB_COUNT.

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

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

Retrieve the user-visible name for the given library.

Definition at line 360 of file build_info.cpp.

References LIB_COUNT.

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

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

Retrieve the runtime version number of the given library.

Definition at line 351 of file build_info.cpp.

References LIB_COUNT.

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

std::string game_config::library_versions_report ( )

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

Definition at line 386 of file build_info.cpp.

References compiled, LIB_COUNT, linked, n, and name().

Referenced by full_build_report(), and process_command_args().

void game_config::load_config ( const config v)

Definition at line 269 of file game_config.cpp.

References a, add_color_info(), game_config::server_info::address, game_config::colors::ally_orb_color, c, config::child(), config::child_range(), e, game_config::images::editor_brush, game_config::images::ellipsis, game_config::colors::enemy_orb_color, game_config::images::energy, ERR_NG, game_config::images::flag, game_config::images::flag_icon, game_config::sounds::friend_message, color_t::from_hex_string(), game_config::sounds::game_has_begun, game_config::images::game_logo, game_config::images::game_logo_background, game_config::images::game_title, game_config::images::game_title_background, game_config::sounds::game_user_arrive, game_config::sounds::game_user_leave, config::get(), game_config::images::grid_bottom, game_config::images::grid_top, config::has_attribute(), i, game_config::images::level, game_config::images::linger, game_config::images::missing, game_config::images::mouseover, game_config::colors::moved_orb_color, game_config::server_info::name, game_config::images::observer, game_config::images::orb, game_config::colors::partial_orb_color, game_config::sounds::status::petrified, game_config::sounds::player_joins, game_config::sounds::player_leaves, game_config::sounds::status::poisoned, game_config::sounds::private_message, game_config::sounds::public_message, game_config::sounds::ready_for_start, s, game_config::images::selected, game_config::sounds::server_message, show_ally_orb, game_config::sounds::status::slowed, utils::split(), game_config::images::terrain_mask, tile_size, game_config::sounds::timer_bell, game_config::images::tod_bright, game_config::images::tod_dark, game_config::sounds::turn_bell, game_config::colors::unmoved_orb_color, game_config::images::unreachable, game_config::images::victory_laurel, game_config::images::victory_laurel_easy, game_config::images::victory_laurel_hardest, and zoom_levels.

Referenced by BOOST_AUTO_TEST_CASE(), test_utils::game_config_manager::game_config_manager(), game_config_manager::init_game_config(), and game_lua_kernel::initialize().

std::string game_config::optional_features_report ( )

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

Definition at line 426 of file build_info.cpp.

References game_config::optional_feature::enabled, f, features, game_config::optional_feature::name, name(), and optional_features_table().

Referenced by full_build_report(), and process_command_args().

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

Return a localized features table.

Definition at line 332 of file build_info.cpp.

References _(), and name().

Referenced by optional_features_report().

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

Return a color corresponding to the value val red for val=0 to green for val=100, passing by yellow.

Colors are defined by [game_config] keys red_green_scale and red_green_scale_text

Definition at line 540 of file game_config.cpp.

References utils::clamp(), and red_green_scale.

Referenced by game_display::draw_movement_info(), gui2::dialogs::unit_attack::pre_show(), gui2::dialogs::attack_predictions::set_data(), unit_defense(), and unit_weapons().

void game_config::reset_color_info ( )

Definition at line 490 of file game_config.cpp.

Referenced by game_config_manager::init_game_config().

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

Variable Documentation

int game_config::base_income = 2
std::vector<color_t> game_config::blue_white_scale
static

Definition at line 152 of file game_config.cpp.

Referenced by blue_to_white().

std::vector<color_t> game_config::blue_white_scale_text
static

Definition at line 153 of file game_config.cpp.

int game_config::cache_compression_level = 6

Definition at line 101 of file game_config.cpp.

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

bool game_config::debug = false
bool game_config::debug_lua = false
std::vector< std::string > game_config::default_colors

Definition at line 160 of file game_config.cpp.

Referenced by ng::side_engine::side_engine().

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

Definition at line 141 of file game_config.cpp.

Referenced by play_controller::select_music().

std::string game_config::default_preferences_path = ""

Definition at line 62 of file game_config.cpp.

Referenced by filesystem::get_default_prefs_file().

std::string game_config::default_terrain
const std::string game_config::default_title_string
std::vector< std::string > game_config::default_victory_music

Definition at line 142 of file game_config.cpp.

Referenced by play_controller::select_music().

bool game_config::disable_autosave = false
bool game_config::editor = false
bool game_config::exit_at_end = false

Definition at line 121 of file game_config.cpp.

Referenced by playsingle_controller::play_scenario().

std::string game_config::flag_rgb
std::string game_config::fog_prefix

Definition at line 87 of file game_config.cpp.

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

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

Definition at line 177 of file game_config.cpp.

Referenced by footsteps_images().

std::string game_config::foot_teleport_enter

Definition at line 179 of file game_config.cpp.

Referenced by footsteps_images().

std::string game_config::foot_teleport_exit

Definition at line 180 of file game_config.cpp.

Referenced by footsteps_images().

const int game_config::gold_carryover_percentage = 80

Default percentage gold carried over to the next scenario.

Definition at line 79 of file game_config.cpp.

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

double game_config::hex_brightening = 1.25

Definition at line 96 of file game_config.cpp.

Referenced by image::get_brightened(), and image::simplify_type().

double game_config::hex_semi_brightening
double game_config::hp_bar_scaling = 0.666

Definition at line 94 of file game_config.cpp.

Referenced by unit_type::build_full().

bool game_config::ignore_replay_errors = false
int game_config::kill_experience = 8
std::string game_config::lobby_music

Definition at line 139 of file game_config.cpp.

unsigned game_config::lobby_network_timer = 100
unsigned game_config::lobby_refresh = 4000

Definition at line 104 of file game_config.cpp.

Referenced by gui2::dialogs::mp_lobby::network_handler().

const 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 108 of file game_config.cpp.

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

const version_info game_config::min_savegame_version

Definition at line 190 of file game_config.hpp.

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

bool game_config::mp_debug = false
bool game_config::no_addons = false

Definition at line 124 of file game_config.cpp.

Referenced by game_config_manager::load_game_config().

bool game_config::no_delay = false
const std::string game_config::observer_team_name = "observer"

observer team name used for observer team chat

Definition at line 106 of file game_config.cpp.

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

std::string game_config::path = ""

Definition at line 56 of file game_config.cpp.

Referenced by campaignd::add_license(), preferences::editor::add_recent_files_entry(), desktop::add_user_bookmark(), filesystem::base_name(), BOOST_AUTO_TEST_CASE(), font::check_font_file(), filesystem::create_directory_if_missing(), filesystem::create_directory_if_missing_recursive(), wb::manager::create_temp_move(), filesystem::delete_directory(), filesystem::delete_file(), filesystem::dir_size(), filesystem::directory_name(), editor::context_manager::expand_load_mru_menu(), filesystem::file_exists(), filesystem::file_modified_time(), filesystem::file_size(), findfile(), 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_binary_dir_location(), filesystem::get_binary_file_location(), filesystem::get_binary_paths(), filesystem::get_cwd(), filesystem::get_default_prefs_file(), filesystem::get_dir(), filesystem::get_exe_dir(), filesystem::get_files_in_dir(), filesystem::get_independent_image_path(), filesystem::get_intl_dir(), hotkey::command_executor::get_menu_image(), pathfind::paths::dest_vect::get_path(), filesystem::get_program_invocation(), filesystem::get_short_wml_path(), filesystem::get_wml_location(), handle_preprocess_command(), init_textdomains(), lua_gui2::intf_get_dialog_value(), intf_modify_ai(), filesystem::is_bzip2_file(), filesystem::is_directory(), filesystem::is_gzip_file(), filesystem::is_path_sep(), filesystem::is_relative(), filesystem::is_root(), filesystem::istream_file(), campaignd::server::load_config(), game_config_manager::load_game_config(), gui::menu::imgsel_style::load_image(), gui::button::load_images(), image::localized_file_uptodate(), luaW_getglobal(), main(), filesystem::make_directory(), font::manager::manager(), filesystem::nearest_extant_parent(), filesystem::normalize_path(), font::open_font_impl(), filesystem::ostream_file(), process_command_args(), ai::ai_default_rca::candidate_action_evaluation_loop::remove_completed_cas(), preferences::editor::remove_recent_files_entry(), filesystem::root_name(), game_lua_kernel::run_filter(), events::mouse_handler::select_hex(), hotkey::command_executor_default::set_button_state(), arrow::set_path(), filesystem::binary_paths_manager::set_paths(), filesystem::set_user_data_dir(), gui2::dialogs::preferences_dialog::setup_hotkey_list(), events::menu_handler::show_enemy_moves(), preferences::show_wesnothd_server_search(), filesystem::subtract_path(), unarchive_dir(), wesnoth_global_fixture::wesnoth_global_fixture(), game_events::WML_HANDLER_FUNCTION(), and font::manager::~manager().

int game_config::poison_amount = 8
int game_config::recall_cost = 20
std::vector< color_t > game_config::red_green_scale

Definition at line 149 of file game_config.cpp.

Referenced by red_to_green().

std::vector< color_t > game_config::red_green_scale_text

Definition at line 150 of file game_config.cpp.

int game_config::rest_heal_amount = 2
const std::string game_config::revision = VERSION
std::vector< server_info > game_config::server_list

Definition at line 110 of file game_config.cpp.

Referenced by game_launcher::game_launcher(), and preferences::server_list().

bool game_config::show_ally_orb
bool game_config::show_enemy_orb
bool game_config::show_moved_orb
bool game_config::show_partial_orb
bool game_config::show_unmoved_orb
std::string game_config::shroud_prefix

Definition at line 87 of file game_config.cpp.

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

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

Definition at line 158 of file game_config.cpp.

Referenced by font::get_pango_color_from_id().

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

Definition at line 156 of file game_config.cpp.

Referenced by font::get_color_string_pango().

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

Definition at line 155 of file game_config.cpp.

Referenced by team::get_side_color_range(), and image::getMinimap().

const version_info game_config::test_version

Definition at line 191 of file game_config.hpp.

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

unsigned int game_config::tile_size = 72
std::string game_config::title_music

Definition at line 139 of file game_config.cpp.

Referenced by do_gameloop().

std::string game_config::unit_rgb

Definition at line 147 of file game_config.cpp.

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

const std::string game_config::version = VERSION
int game_config::village_income = 1
int game_config::village_support = 1
std::string game_config::wesnoth_program_dir

Definition at line 65 of file game_config.cpp.

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

const version_info game_config::wesnoth_version
double game_config::xp_bar_scaling = 0.5

Definition at line 95 of file game_config.cpp.

Referenced by unit_type::build_full().

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

Definition at line 89 of file game_config.cpp.

Referenced by load_config().