game_config.hpp

Go to the documentation of this file.
00001 /* $Id: game_config.hpp 54051 2012-04-30 21:52:38Z brilliand $ */
00002 /*
00003    Copyright (C) 2003 - 2012 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 #ifndef GAME_CONFIG_H_INCLUDED
00016 #define GAME_CONFIG_H_INCLUDED
00017 
00018 class config;
00019 class version_info;
00020 class color_range;
00021 
00022 #include "tstring.hpp"
00023 
00024 #include <SDL_types.h>
00025 
00026 #include <vector>
00027 #include <map>
00028 
00029 //basic game configuration information is here.
00030 namespace game_config
00031 {
00032     extern int base_income;
00033     extern int village_income;
00034     extern int village_support;
00035     extern int poison_amount;
00036     extern int rest_heal_amount;
00037     extern int recall_cost;
00038     extern int kill_experience;
00039     extern unsigned lobby_network_timer;
00040     extern unsigned lobby_refresh;
00041     extern const std::string version;
00042     extern const std::string revision;
00043 
00044     inline int kill_xp(int level)
00045     {
00046         return level ? kill_experience * level : kill_experience / 2;
00047     }
00048 
00049     extern std::string wesnoth_program_dir;
00050 
00051     /** Default percentage gold carried over to the next scenario. */
00052     extern const int gold_carryover_percentage;
00053 
00054     extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, new_syntax, no_delay, small_gui, disable_autosave;
00055 
00056     extern int cache_compression_level;
00057 
00058     extern std::string path;
00059     extern std::string preferences_dir;
00060     extern std::string default_preferences_path;
00061 
00062     struct server_info {
00063         server_info() : name(""), address("") { }
00064         std::string name;
00065         std::string address; /**< may include ':' followed by port number */
00066     };
00067     extern std::vector<server_info> server_list;
00068 
00069     extern std::string title_music,
00070             lobby_music,
00071             default_victory_music,
00072             default_defeat_music;
00073 
00074     namespace images {
00075     extern std::string game_title,
00076             // orbs and hp/xp bar
00077             moved_orb,
00078             unmoved_orb,
00079             partmoved_orb,
00080             enemy_orb,
00081             ally_orb,
00082             energy,
00083             // flags
00084             flag,
00085             flag_icon,
00086             // hex overlay
00087             terrain_mask,
00088             grid_top,
00089             grid_bottom,
00090             mouseover,
00091             selected,
00092             editor_brush,
00093             unreachable,
00094             linger,
00095             // GUI elements
00096             observer,
00097             tod_bright,
00098             tod_dark,
00099             checked_menu,
00100             unchecked_menu,
00101             wml_menu,
00102             level,
00103             ellipsis,
00104             missing;
00105     } //images
00106 
00107 
00108     extern std::string shroud_prefix, fog_prefix;
00109 
00110     extern double hp_bar_scaling, xp_bar_scaling;
00111     extern double hex_brightening;
00112     extern double hex_semi_brightening;
00113 
00114     extern std::string flag_rgb;
00115     extern std::vector<Uint32> red_green_scale;
00116     extern std::vector<Uint32> red_green_scale_text;
00117 
00118     extern std::vector<std::string> foot_speed_prefix;
00119     extern std::string foot_teleport_enter, foot_teleport_exit;
00120 
00121     extern std::map<std::string, color_range> team_rgb_range;
00122     extern std::map<std::string, t_string> team_rgb_name;
00123     extern std::map<std::string, std::vector<Uint32> > team_rgb_colors;
00124 
00125     /** observer team name used for observer team chat */
00126     extern const std::string observer_team_name;
00127 
00128     /**
00129      * The maximum number of hexes on a map and items in an array and also used
00130      * as maximum in wml loops.
00131      * WARNING : This should not be set to less than the max map area
00132      */
00133     extern const size_t max_loop;
00134 
00135     namespace sounds {
00136         extern const std::string turn_bell, timer_bell, receive_message,
00137                 receive_message_highlight, receive_message_friend,
00138                 receive_message_server, user_arrive, user_leave,
00139                 game_user_arrive, game_user_leave;
00140         extern const std::string button_press, checkbox_release, slider_adjust,
00141                 menu_expand, menu_contract, menu_select;
00142     }
00143 
00144     void load_config(const config &cfg);
00145 
00146     void add_color_info(const config& v);
00147     const std::vector<Uint32>& tc_info(const std::string& name);
00148     const color_range& color_info(const std::string& name);
00149 
00150     /**
00151      * Return a color corresponding to the value val
00152      * red for val=0 to green for val=100, passing by yellow.
00153      * Colors are defined by [game_config] keys
00154      * red_green_scale and red_green_scale_text
00155      */
00156 
00157     Uint32 red_to_green(int val, bool for_text = true);
00158     Uint32 blue_to_white(int val, bool for_text = true);
00159 
00160     extern const version_info wesnoth_version;
00161     extern const version_info min_savegame_version;
00162     extern const std::string  test_version;
00163 }
00164 
00165 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:52 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs