multiplayer_create.hpp

Go to the documentation of this file.
00001 /* $Id: multiplayer_create.hpp 23842 2008-02-16 08:47:16Z mordante $ */
00002 /*
00003    Copyright (C) 2007 - 2008
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 
00015 //! @file multiplayer_create.hpp
00016 //!
00017 
00018 #ifndef MULTIPLAYER_CREATE_HPP_INCLUDED
00019 #define MULTIPLAYER_CREATE_HPP_INCLUDED
00020 
00021 #include "multiplayer_ui.hpp"
00022 #include "widgets/slider.hpp"
00023 #include "widgets/label.hpp"
00024 #include "widgets/combo.hpp"
00025 #include "mapgen.hpp"
00026 #include "tooltips.hpp"
00027 
00028 namespace mp {
00029 
00030 class create : public mp::ui
00031 {
00032 public:
00033     struct parameters
00034     {
00035         parameters() :
00036             name(),
00037             era(),
00038             num_turns(0),
00039             village_gold(0),
00040             xp_modifier(0),
00041             mp_countdown_init_time(0),
00042             mp_countdown_reservoir_time(0),
00043             mp_countdown_turn_bonus(0),
00044             mp_countdown_action_bonus(0),
00045             mp_countdown(false),
00046             use_map_settings(false),
00047             random_start_time(false),
00048             fog_game(false),
00049             shroud_game(false),
00050             allow_observers(false),
00051             share_view(false),
00052             share_maps(false),
00053             saved_game(false),
00054             scenario_data()
00055 
00056         { reset(); };
00057 
00058         void reset() {
00059             name = "";
00060             era = "";
00061             password = "";
00062             num_turns = 0;
00063             village_gold = 0;
00064             xp_modifier = 0;
00065             mp_countdown_init_time=0;
00066             mp_countdown_reservoir_time=0;
00067             mp_countdown_turn_bonus=0;
00068             mp_countdown_action_bonus=0;
00069             mp_countdown=false;
00070             use_map_settings = random_start_time = fog_game = shroud_game = allow_observers = share_view = share_maps = false;
00071 
00072             scenario_data.clear();
00073         }
00074 
00075         // The items returned while configuring the game
00076 
00077         std::string name;
00078         std::string era;
00079         std::string password;
00080 
00081         int num_turns;
00082         int village_gold;
00083         int xp_modifier;
00084         int mp_countdown_init_time;
00085         int mp_countdown_reservoir_time;
00086         int mp_countdown_turn_bonus;
00087         int mp_countdown_action_bonus;
00088         bool mp_countdown;
00089         bool use_map_settings;
00090         bool random_start_time;
00091         bool fog_game;
00092         bool shroud_game;
00093         bool allow_observers;
00094         bool share_view;
00095         bool share_maps;
00096 
00097         bool saved_game;
00098 
00099         //! If the game is to be randomly generated, the map generator
00100         //! will create the scenario data in this variable
00101         config scenario_data;
00102     };
00103 
00104     create(game_display& dist, const config& game_config, chat& c, config& gamelist);
00105     ~create();
00106 
00107     parameters& get_parameters();
00108 
00109 protected:
00110     virtual void layout_children(const SDL_Rect& rect);
00111     virtual void process_event();
00112     virtual void hide_children(bool hide=true);
00113 
00114 private:
00115     void update_minimap(void);
00116 
00117     tooltips::manager tooltip_manager_;
00118     int map_selection_;
00119     int mp_countdown_init_time_;
00120     int mp_countdown_reservoir_time_;
00121 
00122 
00123     std::vector<std::string> user_maps_;
00124     std::vector<std::string> map_options_;
00125     //! Due to maps not available the index of the selected map and 
00126     //! mp scenarios is not 1:1 so we use a lookup table.
00127     std::vector<size_t> map_index_;
00128 
00129     gui::menu maps_menu_;
00130     gui::slider turns_slider_;
00131     gui::label turns_label_;
00132     gui::button countdown_game_;
00133     gui::slider countdown_init_time_slider_;
00134     gui::label countdown_init_time_label_;
00135     gui::slider countdown_reservoir_time_slider_;
00136     gui::label countdown_reservoir_time_label_;
00137     gui::label countdown_turn_bonus_label_;
00138     gui::slider countdown_turn_bonus_slider_;
00139     gui::label countdown_action_bonus_label_;
00140     gui::slider countdown_action_bonus_slider_;
00141     gui::slider village_gold_slider_;
00142     gui::label village_gold_label_;
00143     gui::slider xp_modifier_slider_;
00144     gui::label xp_modifier_label_;
00145 
00146     gui::label name_entry_label_;
00147     gui::label num_players_label_;
00148     gui::label map_size_label_;
00149     gui::label era_label_;
00150     gui::label map_label_;
00151 
00152     gui::button use_map_settings_;
00153     gui::button random_start_time_;
00154     gui::button fog_game_;
00155     gui::button shroud_game_;
00156     gui::button observers_game_;
00157     gui::button cancel_game_;
00158     gui::button launch_game_;
00159     gui::button regenerate_map_;
00160     gui::button generator_settings_;
00161     gui::button password_button_;
00162 
00163     gui::combo era_combo_;
00164     gui::combo vision_combo_;
00165     gui::textbox name_entry_;
00166 
00167     util::scoped_ptr<surface_restorer> minimap_restorer_;
00168     SDL_Rect minimap_rect_;
00169 
00170     util::scoped_ptr<map_generator> generator_;
00171 
00172     parameters parameters_;
00173 };
00174 
00175 } // end namespace mp
00176 
00177 #endif
00178 

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