31 #define DBG_NG LOG_STREAM(debug, log_engine)
32 #define LOG_NG LOG_STREAM(info, log_engine)
33 #define ERR_NG LOG_STREAM(err, log_engine)
52 #elif defined(VCS_SHORT_HASH) && defined(VCS_WC_MODIFIED)
55 + VCS_SHORT_HASH + (VCS_WC_MODIFIED ?
"-Modified" :
"-Clean") +
")";
183 #ifdef DEFAULT_PREFS_PATH
193 base_income = v[
"base_income"].to_int(2);
194 village_income = v[
"village_income"].to_int(1);
195 village_support = v[
"village_support"].to_int(1);
196 poison_amount = v[
"poison_amount"].to_int(8);
197 rest_heal_amount = v[
"rest_heal_amount"].to_int(2);
198 recall_cost = v[
"recall_cost"].to_int(20);
199 kill_experience = v[
"kill_experience"].to_int(8);
200 lobby_refresh = v[
"lobby_refresh"].to_int(2000);
201 default_terrain = v[
"default_terrain"].str();
202 tile_size = v[
"tile_size"].to_int(72);
204 title_music = v[
"title_music"].str();
205 lobby_music = v[
"lobby_music"].str();
206 default_victory_music = v[
"default_victory_music"].str();
207 default_defeat_music = v[
"default_defeat_music"].str();
218 show_ally_orb = v[
"show_ally_orb"].to_bool(
true);
219 show_enemy_orb = v[
"show_enemy_orb"].to_bool(
false);
220 show_moved_orb = v[
"show_moved_orb"].to_bool(
true);
221 show_partial_orb = v[
"show_partly_orb"].to_bool(
true);
222 show_unmoved_orb = v[
"show_unmoved_orb"].to_bool(
true);
229 orb =
i[
"orb"].str();
232 flag =
i[
"flag"].str();
252 hp_bar_scaling = v[
"hp_bar_scaling"].to_double(0.666);
253 xp_bar_scaling = v[
"xp_bar_scaling"].to_double(0.5);
254 hex_brightening = v[
"hex_brightening"].to_double(1.25);
256 foot_speed_prefix =
utils::split(v[
"footprint_prefix"]);
257 foot_teleport_enter = v[
"footprint_teleport_enter"].str();
258 foot_teleport_exit = v[
"footprint_teleport_exit"].str();
260 shroud_prefix = v[
"shroud_prefix"].str();
261 fog_prefix = v[
"fog_prefix"].str();
269 std::string color_string = v[
"red_green_scale"].str();
270 if(!
string2rgb(color_string, red_green_scale)) {
271 ERR_NG <<
"can't parse color string red_green_scale, ignoring: " << color_string << std::endl;
273 if (red_green_scale.empty()) {
274 red_green_scale.push_back(0x00FFFF00);
277 color_string = v[
"red_green_scale_text"].str();
278 if(!
string2rgb(color_string, red_green_scale_text)) {
279 ERR_NG <<
"can't parse color string red_green_scale_text, ignoring: " << color_string << std::endl;
281 if (red_green_scale_text.empty()) {
282 red_green_scale_text.push_back(0x00FFFF00);
285 color_string = v[
"blue_white_scale"].str();
286 if(!
string2rgb(color_string, blue_white_scale)) {
287 ERR_NG <<
"can't parse color string blue_white_scale, ignoring: " << color_string << std::endl;
289 if (blue_white_scale.empty()) {
290 blue_white_scale.push_back(0x00FFFFFF);
293 color_string = v[
"blue_white_scale_text"].str();
294 if(!
string2rgb(color_string, blue_white_scale_text)) {
295 ERR_NG <<
"can't parse color string blue_white_scale_text, ignoring: " << color_string << std::endl;
297 if (blue_white_scale_text.empty()) {
298 blue_white_scale_text.push_back(0x00FFFFFF);
305 sinf.
name = server[
"name"].str();
306 sinf.
address = server[
"address"].str();
307 server_list.push_back(sinf);
312 if (
s.has_attribute(
"turn_bell"))
turn_bell =
s[
"turn_bell"].str();
313 if (
s.has_attribute(
"timer_bell"))
timer_bell =
s[
"timer_bell"].str();
314 if (
s.has_attribute(
"public_message"))
public_message =
s[
"public_message"].str();
315 if (
s.has_attribute(
"private_message"))
private_message =
s[
"private_message"].str();
316 if (
s.has_attribute(
"friend_message"))
friend_message =
s[
"friend_message"].str();
317 if (
s.has_attribute(
"server_message"))
server_message =
s[
"server_message"].str();
318 if (
s.has_attribute(
"player_joins"))
player_joins =
s[
"player_joins"].str();
319 if (
s.has_attribute(
"player_leaves"))
player_leaves =
s[
"player_leaves"].str();
320 if (
s.has_attribute(
"game_user_arrive"))
game_user_arrive =
s[
"game_user_arrive"].str();
321 if (
s.has_attribute(
"game_user_leave"))
game_user_leave =
s[
"game_user_leave"].str();
322 if (
s.has_attribute(
"ready_for_start"))
ready_for_start =
s[
"ready_for_start"].str();
323 if (
s.has_attribute(
"game_has_begun"))
game_has_begun =
s[
"game_has_begun"].str();
327 if (ss.has_attribute(
"poisoned"))
poisoned = ss[
"poisoned"].str();
328 if (ss.has_attribute(
"slowed"))
slowed = ss[
"slowed"].str();
329 if (ss.has_attribute(
"petrified"))
petrified = ss[
"petrified"].str();
339 *a2 = teamC.get(
"rgb");
344 std::vector<Uint32> temp;
346 std::stringstream ss;
347 ss <<
"can't parse color string:\n" << teamC.debug() <<
"\n";
350 team_rgb_range.insert(std::make_pair(
id,
color_range(temp)));
351 team_rgb_name[
id] = teamC[
"name"];
353 LOG_NG <<
"registered color range '" <<
id <<
"': " << team_rgb_range[
id].debug() <<
'\n';
356 std::vector<Uint32> tp =
palette(team_rgb_range[
id]);
360 team_rgb_colors.insert(std::make_pair(
id,tp));
367 std::vector<Uint32> temp;
369 ERR_NG <<
"Invalid color palette: " << rgb.second << std::endl;
371 team_rgb_colors.insert(std::make_pair(rgb.first, temp));
372 LOG_NG <<
"registered color palette: " << rgb.first <<
'\n';
379 std::map<std::string, color_range>::const_iterator
i = team_rgb_range.find(name);
380 if(i == team_rgb_range.end()) {
381 std::vector<Uint32> temp;
385 team_rgb_range.insert(std::make_pair(name,
color_range(temp)));
393 std::map<std::string, std::vector<Uint32> >::const_iterator
i = team_rgb_colors.find(name);
394 if(i == team_rgb_colors.end()) {
395 std::vector<Uint32> temp;
397 static std::vector<Uint32> stv;
398 ERR_NG <<
"Invalid color palette: " << name << std::endl;
401 team_rgb_colors.insert(std::make_pair(name,temp));
408 const std::vector<Uint32>& color_scale =
410 val = std::max<int>(0, std::min<int>(
val, 100));
411 int lvl = (color_scale.size()-1) * val / 100;
412 return color_scale[lvl];
416 const std::vector<Uint32>& color_scale =
418 val = std::max<int>(0, std::min<int>(
val, 100));
419 int lvl = (color_scale.size()-1) * val / 100;
420 return color_scale[lvl];
child_itors child_range(const std::string &key)
std::string game_user_leave
std::map< std::string, color_range > team_rgb_range
const std::vector< Uint32 > & tc_info(const std::string &name)
const std::string menu_expand
static l_noret error(LoadState *S, const char *why)
std::string default_victory_music
std::string private_message
std::string selected_menu
static std::vector< Uint32 > blue_white_scale_text
bool string2rgb(const std::string &s, std::vector< Uint32 > &result)
attribute_map::value_type attribute
const std::string slider_adjust
std::string friend_message
GLuint const GLfloat * val
std::string get_default_title_string()
const std::string menu_select
std::string unchecked_menu
std::string enemy_orb_color
Definitions for the interface to Wesnoth Markup Language (WML).
std::string address
may include ':' followed by port number
void load_config(const config &v)
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...
Variant for storing WML attributes.
std::string ally_orb_color
std::string default_defeat_music
static UNUSEDNOWARN std::string _(const char *str)
std::string deselected_menu
GLsizei const char ** path
unsigned lobby_network_timer
std::string ready_for_start
const int gold_carryover_percentage
Default percentage gold carried over to the next scenario.
void add_color_info(const config &v)
std::string game_user_arrive
bool ignore_replay_errors
const version_info test_version("test")
std::string foot_teleport_enter
GLboolean GLboolean GLboolean GLboolean a
std::string game_title_background
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...
static std::vector< Uint32 > blue_white_scale
std::string shroud_prefix
Manage the empty-palette in the editor.
std::string default_terrain
std::string moved_orb_color
Templates and utility-routines for strings and numbers.
#define MIN_SAVEGAME_VERSION
Some older savegames of Wesnoth cannot be loaded anymore, this variable defines the minimum required ...
std::string server_message
Some defines: VERSION, PACKAGE, MIN_SAVEGAME_VERSION.
std::string unmoved_orb_color
const std::string revision
Game configuration data as global variables.
std::string public_message
Uint32 blue_to_white(int val, bool for_text)
const std::string menu_contract
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
std::vector< Uint32 > red_green_scale
std::vector< std::string > foot_speed_prefix
const version_info wesnoth_version(VERSION)
Represents version numbers.
GLuint const GLchar * name
const attribute_value * get(const std::string &key) const
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
std::string player_leaves
const std::string button_press
std::string foot_teleport_exit
static std::map< std::string, std::string > images
std::map< std::string, std::vector< Uint32 > > team_rgb_colors
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
const color_range & color_info(const std::string &name)
Standard logging facilities (interface).
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
std::vector< Uint32 > red_green_scale_text
std::string partial_orb_color
A config object defines a single node in a WML file, with access to child nodes.
const version_info min_savegame_version(MIN_SAVEGAME_VERSION)
std::map< std::string, t_string > team_rgb_name
std::string game_has_begun
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::vector< Uint32 > palette(color_range cr)
Creates a reference color palette from a color range.
const std::string version
GLsizei const GLcharARB ** string
std::vector< server_info > server_list
std::string wesnoth_program_dir
static lg::log_domain log_engine("engine")
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