The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef GAME_CONFIG_H_INCLUDED
15 #define GAME_CONFIG_H_INCLUDED
16 
17 class config;
18 class version_info;
19 class color_range;
20 
21 #include "tstring.hpp"
22 
23 #include <vector>
24 #include <map>
25 #include <stdint.h>
26 
27 //basic game configuration information is here.
28 namespace game_config
29 {
30  extern int base_income;
31  extern int village_income;
32  extern int village_support;
33  extern int poison_amount;
34  extern int rest_heal_amount;
35  extern int recall_cost;
36  extern int kill_experience;
37  extern int tile_size;
38  extern unsigned lobby_network_timer;
39  extern unsigned lobby_refresh;
40  extern const std::string version;
41  extern const std::string revision;
42  extern const std::string default_title_string;
44 
45  inline int kill_xp(int level)
46  {
47  return level ? kill_experience * level : kill_experience / 2;
48  }
49 
51 
52  /** Default percentage gold carried over to the next scenario. */
53  extern const int gold_carryover_percentage;
54 
57 
58  extern int cache_compression_level;
59 
60  extern std::string path;
62 
63  struct server_info {
64  server_info() : name(""), address("") { }
66  std::string address; /**< may include ':' followed by port number */
67  };
68  extern std::vector<server_info> server_list;
69 
70  extern std::string title_music,
74 
75  namespace colors {
81  } // colors
82 
84 
85  namespace images {
86  extern std::string game_title,
88  // orbs and hp/xp bar
89  orb,
90  energy,
91  // flags
92  flag,
93  flag_icon,
94  // hex overlay
96  grid_top,
98  mouseover,
99  selected,
100  editor_brush,
101  unreachable,
102  linger,
103  // GUI elements
104  observer,
105  tod_bright,
106  tod_dark,
109  checked_menu,
111  wml_menu,
112  level,
113  ellipsis,
114  missing,
115  // notifications icon
116  app_icon;
117  } //images
118 
119 
121 
122  extern double hp_bar_scaling, xp_bar_scaling;
123  extern double hex_brightening;
124  extern double hex_semi_brightening;
125 
126  extern std::string flag_rgb;
127  extern std::vector<uint32_t> red_green_scale;
128  extern std::vector<uint32_t> red_green_scale_text;
129 
130  extern std::vector<std::string> foot_speed_prefix;
132 
133  extern std::map<std::string, color_range> team_rgb_range;
134  extern std::map<std::string, t_string> team_rgb_name;
135  extern std::map<std::string, std::vector<uint32_t> > team_rgb_colors;
136 
137  /** observer team name used for observer team chat */
138  extern const std::string observer_team_name;
139 
140  /**
141  * The maximum number of hexes on a map and items in an array and also used
142  * as maximum in wml loops.
143  * WARNING : This should not be set to less than the max map area
144  */
145  extern const size_t max_loop;
146 
147  namespace sounds {
155  namespace status {
157  }
158  }
159 
160  void load_config(const config &cfg);
161 
162  void add_color_info(const config& v);
163  const std::vector<uint32_t>& tc_info(const std::string& name);
164  const color_range& color_info(const std::string& name);
165 
166  /**
167  * Return a color corresponding to the value val
168  * red for val=0 to green for val=100, passing by yellow.
169  * Colors are defined by [game_config] keys
170  * red_green_scale and red_green_scale_text
171  */
172 
173  uint32_t red_to_green(int val, bool for_text = true);
174  uint32_t blue_to_white(int val, bool for_text = true);
175 
179 
181 }
182 
183 #endif
int kill_xp(int level)
Definition: game_config.hpp:45
std::string game_user_leave
std::string tod_dark
Definition: game_config.cpp:84
bool show_unmoved_orb
Definition: game_config.cpp:81
double hp_bar_scaling
double xp_bar_scaling
std::map< std::string, color_range > team_rgb_range
int village_support
Definition: game_config.cpp:39
GLint level
Definition: glew.h:1220
const std::vector< Uint32 > & tc_info(const std::string &name)
std::string mouseover
Definition: game_config.cpp:84
const std::string menu_expand
boost::uint32_t uint32_t
Definition: xbrz.hpp:45
std::string default_victory_music
Definition: game_config.cpp:68
std::string energy
Definition: game_config.cpp:84
std::string private_message
std::string game_title
Definition: game_config.cpp:84
double hex_semi_brightening
std::string selected_menu
std::string lobby_music
Definition: game_config.cpp:68
std::string unreachable
Definition: game_config.cpp:84
const std::string slider_adjust
std::string friend_message
GLuint const GLfloat * val
Definition: glew.h:2614
std::string get_default_title_string()
const std::string default_title_string
const std::string menu_select
std::string unchecked_menu
bool exit_at_end
Definition: game_config.cpp:63
std::string enemy_orb_color
Definition: game_config.cpp:74
bool show_enemy_orb
Definition: game_config.cpp:81
std::string player_joins
std::string address
may include ':' followed by port number
Definition: game_config.hpp:66
void load_config(const config &v)
int rest_heal_amount
Definition: game_config.cpp:41
Uint32 red_to_green(int val, bool for_text)
Return a color corresponding to the value val red for val=0 to green for val=100, passing by yellow...
bool show_ally_orb
Definition: game_config.cpp:81
std::string terrain_mask
Definition: game_config.cpp:84
std::string flag_icon
Definition: game_config.cpp:84
std::string turn_bell
std::string timer_bell
std::string ally_orb_color
Definition: game_config.cpp:74
std::string default_defeat_music
Definition: game_config.cpp:68
std::string deselected_menu
unsigned lobby_network_timer
Definition: game_config.cpp:45
bool disable_autosave
Definition: game_config.cpp:64
std::string ready_for_start
const int gold_carryover_percentage
Default percentage gold carried over to the next scenario.
Definition: game_config.cpp:47
void add_color_info(const config &v)
const GLdouble * v
Definition: glew.h:1359
std::string game_user_arrive
bool ignore_replay_errors
Definition: game_config.cpp:63
const version_info test_version("test")
std::string selected
Definition: game_config.cpp:84
std::string foot_teleport_enter
std::string game_title_background
Definition: game_config.cpp:84
const size_t max_loop
The maximum number of hexes on a map and items in an array and also used as maximum in wml loops...
int kill_experience
Definition: game_config.cpp:43
std::string grid_bottom
Definition: game_config.cpp:84
std::string path
std::string shroud_prefix
std::string default_terrain
Definition: game_config.cpp:49
std::string moved_orb_color
Definition: game_config.cpp:74
GLuint GLuint64EXT address
Definition: glew.h:11276
std::string flag_rgb
std::string server_message
std::string editor_brush
Definition: game_config.cpp:84
std::string unmoved_orb_color
Definition: game_config.cpp:74
const std::string revision
Definition: game_config.cpp:57
Game configuration data as global variables.
Definition: build_info.cpp:38
std::string public_message
Uint32 blue_to_white(int val, bool for_text)
int village_income
Definition: game_config.cpp:38
const std::string menu_contract
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
Definition: color_range.hpp:54
std::string title_music
Definition: game_config.cpp:68
bool show_moved_orb
Definition: game_config.cpp:81
std::vector< Uint32 > red_green_scale
std::vector< std::string > foot_speed_prefix
const version_info wesnoth_version(VERSION)
std::string observer
Definition: game_config.cpp:84
Represents version numbers.
Definition: version.hpp:44
GLuint const GLchar * name
Definition: glew.h:1782
std::string player_leaves
const std::string button_press
std::string foot_teleport_exit
static std::map< std::string, std::string > images
Definition: about.cpp:58
std::map< std::string, std::vector< Uint32 > > team_rgb_colors
unsigned lobby_refresh
Definition: game_config.cpp:46
const color_range & color_info(const std::string &name)
double hex_brightening
std::string tod_bright
Definition: game_config.cpp:84
std::string ellipsis
std::string checked_menu
bool show_partial_orb
Definition: game_config.cpp:81
std::vector< Uint32 > red_green_scale_text
std::string partial_orb_color
Definition: game_config.cpp:74
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
std::string wml_menu
const version_info min_savegame_version(MIN_SAVEGAME_VERSION)
std::map< std::string, t_string > team_rgb_name
std::string game_has_begun
const std::string version
Definition: game_config.cpp:48
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::string grid_top
Definition: game_config.cpp:84
std::string fog_prefix
std::vector< server_info > server_list
std::string app_icon
std::string wesnoth_program_dir
Definition: game_config.cpp:61
std::string linger
Definition: game_config.cpp:84
std::string default_preferences_path
const std::string observer_team_name
observer team name used for observer team chat
const std::string checkbox_release
int cache_compression_level
Definition: game_config.cpp:66