The Battle for Wesnoth  1.13.4+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_CAIRO, LIB_PANGO, LIB_SDL,
  LIB_SDL_IMAGE, LIB_SDL_MIXER, LIB_SDL_TTF, LIB_SDL_NET,
  LIB_PNG, LIB_COUNT
}
 

Functions

std::vector< optional_featureoptional_features_table ()
 Return a localized features table. More...
 
const std::stringlibrary_build_version (LIBRARY_ID lib)
 Retrieve the build-time version number of the given library. More...
 
const std::stringlibrary_runtime_version (LIBRARY_ID lib)
 Retrieve the runtime version number of the given library. More...
 
const std::stringlibrary_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...
 
void load_config (const config &v)
 
void add_color_info (const config &v)
 
const color_rangecolor_info (const std::string &name)
 
const std::vector< Uint32 > & tc_info (const std::string &name)
 
Uint32 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...
 
Uint32 blue_to_white (int val, bool for_text)
 
std::string get_default_title_string ()
 
int kill_xp (int level)
 

Variables

int base_income = 2
 
int village_income = 1
 
int village_support = 1
 
int poison_amount = 8
 
int rest_heal_amount = 2
 
int recall_cost = 20
 
int kill_experience = 8
 
int tile_size = 72
 
unsigned lobby_network_timer = 100
 
unsigned lobby_refresh = 4000
 
const int gold_carryover_percentage = 80
 Default percentage gold carried over to the next scenario. More...
 
const std::string version = VERSION
 
std::string default_terrain
 
const std::string revision = VERSION
 
std::string wesnoth_program_dir
 
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
 
int cache_compression_level = 6
 
std::string title_music
 
std::string lobby_music
 
std::string default_victory_music
 
std::string default_defeat_music
 
bool show_ally_orb
 
bool show_enemy_orb
 
bool show_moved_orb
 
bool show_partial_orb
 
bool show_unmoved_orb
 
std::string shroud_prefix
 
std::string fog_prefix
 
std::string flag_rgb
 
std::vector< Uint32 > red_green_scale
 
std::vector< Uint32 > red_green_scale_text
 
static std::vector< Uint32 > blue_white_scale
 
static std::vector< Uint32 > blue_white_scale_text
 
double hp_bar_scaling = 0.666
 
double xp_bar_scaling = 0.5
 
double hex_brightening = 1.25
 
std::vector< std::stringfoot_speed_prefix
 
std::string foot_teleport_enter
 
std::string foot_teleport_exit
 
std::map< std::string,
color_range
team_rgb_range
 
std::map< std::string, t_stringteam_rgb_name
 
std::map< std::string,
std::vector< Uint32 > > 
team_rgb_colors
 
const version_info wesnoth_version (VERSION)
 
const version_info min_savegame_version (MIN_SAVEGAME_VERSION)
 
const version_info test_version ("test")
 
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::string path = ""
 
std::string default_preferences_path = ""
 
std::vector< server_infoserver_list
 
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 77 of file config_cache.hpp.

Enumeration Type Documentation

Enumerator
LIB_BOOST 
LIB_CAIRO 
LIB_PANGO 
LIB_SDL 
LIB_SDL_IMAGE 
LIB_SDL_MIXER 
LIB_SDL_TTF 
LIB_SDL_NET 
LIB_PNG 
LIB_COUNT 

Definition at line 24 of file build_info.hpp.

Function Documentation

void game_config::add_color_info ( const config v)
uint32_t game_config::blue_to_white ( int  val,
bool  for_text 
)

Definition at line 415 of file game_config.cpp.

References blue_white_scale.

Referenced by unit_weapons().

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

Definition at line 45 of file game_config.hpp.

Referenced by ai::attack_analysis::analyze(), and ai::simulated_attack().

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

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

Definition at line 233 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::tgame_version::tgame_version().

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

Retrieve the user-visible name for the given library.

Definition at line 251 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::tgame_version::tgame_version().

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

Retrieve the runtime version number of the given library.

Definition at line 242 of file build_info.cpp.

References LIB_COUNT.

Referenced by gui2::tgame_version::tgame_version().

std::string game_config::library_versions_report ( )

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

Definition at line 277 of file build_info.cpp.

References compiled, LIB_COUNT, and linked.

Referenced by gui2::tgame_version::generate_plain_text_report(), and process_command_args().

void game_config::load_config ( const config v)

Definition at line 191 of file game_config.cpp.

References add_color_info(), game_config::server_info::address, game_config::colors::ally_orb_color, config::child(), config::child_range(), 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, game_config::sounds::game_has_begun, 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, i, 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, game_config::images::selected, game_config::sounds::server_message, game_config::sounds::status::slowed, utils::split(), string2rgb(), game_config::images::terrain_mask, 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, and game_config::images::unreachable.

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 317 of file build_info.cpp.

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

Referenced by gui2::tgame_version::generate_plain_text_report(), and process_command_args().

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

Return a localized features table.

Definition at line 223 of file build_info.cpp.

References _().

Referenced by optional_features_report().

uint32_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 407 of file game_config.cpp.

References red_green_scale.

Referenced by game_display::draw_movement_info(), gui2::set_weapon_info(), unit_defense(), and unit_weapons().

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

Variable Documentation

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

Definition at line 124 of file game_config.cpp.

Referenced by blue_to_white().

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

Definition at line 125 of file game_config.cpp.

int game_config::cache_compression_level = 6

Definition at line 66 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::string game_config::default_defeat_music

Definition at line 68 of file game_config.cpp.

Referenced by play_controller::set_defeat_music_list().

std::string game_config::default_preferences_path = ""

Definition at line 186 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::string game_config::default_victory_music

Definition at line 68 of file game_config.cpp.

Referenced by play_controller::set_victory_music_list().

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

Definition at line 63 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 118 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 132 of file game_config.cpp.

Referenced by footsteps_images().

std::string game_config::foot_teleport_enter

Definition at line 133 of file game_config.cpp.

Referenced by footsteps_images().

std::string game_config::foot_teleport_exit

Definition at line 134 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 47 of file game_config.cpp.

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

double game_config::hex_brightening = 1.25

Definition at line 130 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 127 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 68 of file game_config.cpp.

Referenced by mp::lobby::lobby().

unsigned game_config::lobby_network_timer = 100

Definition at line 45 of file game_config.cpp.

Referenced by gui2::tlobby_main::pre_show().

unsigned game_config::lobby_refresh = 4000

Definition at line 46 of file game_config.cpp.

Referenced by gui2::tlobby_main::network_handler(), and mp::ui::process_network().

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

Referenced by game_events::t_pump::operator()(), and terrain_filter::restrict_size().

const version_info game_config::min_savegame_version

Definition at line 177 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 64 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 145 of file game_config.cpp.

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

std::string game_config::path = ""
int game_config::poison_amount = 8
int game_config::recall_cost = 20
std::vector< uint32_t > game_config::red_green_scale

Definition at line 121 of file game_config.cpp.

Referenced by red_to_green().

std::vector< uint32_t > game_config::red_green_scale_text

Definition at line 122 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 189 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 118 of file game_config.cpp.

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

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

Definition at line 139 of file game_config.cpp.

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

Definition at line 137 of file game_config.cpp.

Referenced by mp::get_color_string().

std::map< std::string, color_range > game_config::team_rgb_range
const version_info game_config::test_version

Definition at line 178 of file game_config.hpp.

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

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

Definition at line 68 of file game_config.cpp.

Referenced by do_gameloop().

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 61 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 128 of file game_config.cpp.

Referenced by unit_type::build_full().