game_config.hpp

Go to the documentation of this file.
00001 /* $Id: game_config.hpp 24808 2008-03-19 14:51:48Z brunowolff $ */
00002 /*
00003    Copyright (C) 2003 - 2008 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 version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 #ifndef GAME_CONFIG_H_INCLUDED
00015 #define GAME_CONFIG_H_INCLUDED
00016 
00017 class config;
00018 
00019 #include "color_range.hpp"
00020 #include "tstring.hpp"
00021 
00022 #include <string>
00023 #include <vector>
00024 #include <map>
00025 
00026 //basic game configuration information is here.
00027 namespace game_config
00028 {
00029     extern int base_income;
00030     extern int village_income;
00031     extern int poison_amount;
00032     extern int rest_heal_amount;
00033     extern int recall_cost;
00034     extern int kill_experience;
00035     extern unsigned lobby_refresh;
00036     extern const std::string version;
00037     extern const std::string revision;
00038 
00039     //! Default percentage gold carried over to the next scenario.
00040     extern const int gold_carryover_percentage;
00041 
00042     //! If true the carried over gold is added to the start gold
00043     //! in the next scenario, otherwise it uses the maximum of
00044     //! starting gold and carryover gold.
00045     extern const bool gold_carryover_add;
00046 
00047     extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, no_delay, disable_autosave;
00048 
00049     extern std::string path;
00050 
00051     struct server_info {
00052         server_info() : name(""), address("") { }
00053         std::string name;
00054         std::string address; //!< may include ':' followed by port number
00055     };
00056     extern std::vector<server_info> server_list;
00057 
00058     extern std::string game_icon, game_title, game_logo, title_music, lobby_music,
00059         moved_ball_image, unmoved_ball_image, partmoved_ball_image,
00060         enemy_ball_image, ally_ball_image, energy_image,
00061         flag_image, flag_icon_image, cross_image,
00062         terrain_mask_image, grid_image, unreachable_image, linger_image,
00063         observer_image, tod_bright_image,
00064         checked_menu_image, unchecked_menu_image, wml_menu_image, level_image,
00065         ellipsis_image;
00066 
00067     extern double hp_bar_scaling, xp_bar_scaling;
00068 
00069     extern std::string flag_rgb;
00070     extern std::vector<Uint32> defense_color_scale;
00071 
00072     extern std::vector<std::string> foot_speed_prefix;
00073     extern std::string foot_teleport_enter, foot_teleport_exit;
00074 
00075     extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding, title_tip_x, title_tip_width, title_tip_padding;
00076 
00077     extern std::map<std::string, color_range> team_rgb_range;
00078     extern std::map<std::string, t_string> team_rgb_name;
00079     extern std::map<std::string, std::vector<Uint32> > team_rgb_colors;
00080 
00081     //! observer team name used for observer team chat
00082     extern const std::string observer_team_name;
00083 
00084     //! The maximum number of hexes on a map and items in an array and also
00085     //! used as maximum in wml loops.
00086     extern const size_t max_loop;
00087 
00088     namespace sounds {
00089         extern const std::string turn_bell, timer_bell, receive_message,
00090                 receive_message_highlight, receive_message_friend,
00091                 receive_message_server, user_arrive, user_leave,
00092                 game_user_arrive, game_user_leave;
00093         extern const std::string button_press, checkbox_release, slider_adjust,
00094                 menu_expand, menu_contract, menu_select;
00095     }
00096 
00097     void load_config(const config* cfg);
00098 
00099     void add_color_info(const config& v);
00100     const std::vector<Uint32>& tc_info(const std::string& name);
00101     const color_range& color_info(const std::string& name);
00102 
00103     struct game_version {
00104         game_version(std::string str);
00105 
00106         //Note gcc 4.1.2(prerelease) as shipped in Debian etch doesn't
00107         //like the name major and minor :( so make gcc happy
00108         unsigned int major_nr;
00109         unsigned int minor_nr;
00110         unsigned int patch;
00111         std::string extra;
00112 
00113         std::string full;
00114     };
00115 
00116     // Note the < <= > and >= operator ignore the extra version the == and != do
00117     // use the extra version.
00118     bool operator<(const struct game_version& a, const struct game_version& b);
00119     bool operator<=(const struct game_version& a, const struct game_version& b);
00120     bool operator>(const struct game_version& a, const struct game_version& b);
00121     bool operator>=(const struct game_version& a, const struct game_version& b);
00122     bool operator==(const struct game_version& a, const struct game_version& b);
00123     bool operator!=(const struct game_version& a, const struct game_version& b);
00124 
00125     extern const struct game_version wesnoth_version;
00126     extern const struct game_version min_savegame_version;
00127     extern const struct game_version test_version;
00128 
00129 }
00130 
00131 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs