The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
configure_engine.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by Nathan Walker <[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 
15 #ifndef MULTIPLAYER_CONFIGURE_ENGINE_INCLUDED
16 #define MULTIPLAYER_CONFIGURE_ENGINE_INCLUDED
17 
18 #include "gettext.hpp"
19 #include "game_preferences.hpp"
20 #include "mp_game_settings.hpp"
21 #include "saved_game.hpp"
22 
23 namespace ng {
24 
25 /**
26  * configure_engine
27  *
28  * this class wraps the parameters relevent to mp_configure,
29  * as well as providing defaults for these parameters.
30  */
32 {
33 public:
35 
36  // Set all parameters to their default values
37  void set_default_values();
38 
39  // check force_lock_settings in config
40  bool force_lock_settings() const;
41 
42  // getter methods
43  std::string game_name() const;
44  int num_turns() const;
45  int village_gold() const;
46  int village_support() const;
47  int xp_modifier() const;
48  int mp_countdown_init_time() const;
49  int mp_countdown_reservoir_time() const;
50  int mp_countdown_turn_bonus() const;
51  int mp_countdown_action_bonus() const;
52  bool mp_countdown() const;
53  bool use_map_settings() const;
54  bool random_start_time() const;
55  bool fog_game() const;
56  bool shroud_game() const;
57  bool allow_observers() const;
58  bool registered_users_only() const;
59  bool shuffle_sides() const;
60  mp_game_settings::RANDOM_FACTION_MODE random_faction_mode() const;
61  const config& options() const;
62 
63  // setter methods
65  void set_num_turns(int val);
66  void set_village_gold(int val);
67  void set_village_support(int val);
68  void set_xp_modifier(int val);
69  void set_mp_countdown_init_time(int val);
70  void set_mp_countdown_reservoir_time(int val);
71  void set_mp_countdown_turn_bonus(int val);
72  void set_mp_countdown_action_bonus(int val);
73  void set_mp_countdown(bool val);
74  void set_use_map_settings(bool val);
75  void set_random_start_time(bool val);
76  void set_fog_game(bool val);
77  void set_shroud_game(bool val);
78  void set_allow_observers(bool val);
79  void set_registered_users_only(bool val);
80  void set_oos_debug(bool val);
81  void set_shuffle_sides(bool val);
82  void set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val);
83  void set_options(const config& cfg);
84 
85  void set_scenario(size_t scenario_num);
86  bool set_scenario(std::string& scenario_id);
87 
88  // parameter defaults
90  int num_turns_default() const;
91  int village_gold_default() const;
92  int village_support_default() const;
93  int xp_modifier_default() const;
98  bool mp_countdown_default() const;
99  bool use_map_settings_default() const;
100  bool random_start_time_default() const;
101  bool fog_game_default() const;
102  bool shroud_game_default() const;
103  bool allow_observers_default() const;
104  bool registered_users_only_default() const;
105  bool shuffle_sides_default() const;
106  mp_game_settings::RANDOM_FACTION_MODE random_faction_mode_default() const;
107  const config& options_default() const;
108 
109  // parameters_ accessor
110  const mp_game_settings& get_parameters() const;
111 
112  const std::vector<std::string>& entry_point_titles() const;
113  void write_parameters();
114 private:
117  // village gold, village support, fog, and shroud are per player, always show values of player 1.
118  /**
119  * @todo This might not be 100% correct, but at the moment
120  * it is not possible to show the fog and shroud per player.
121  * This might change in the future.
122  * NOTE when 'load game' is selected there are no sides.
123  */
125 
126  std::vector<const config*> entry_points_;
127 
128  std::vector<std::string> entry_point_titles_;
129 };
130 
131 } // end namespace ng
132 #endif
133 
void set_registered_users_only(bool val)
int mp_countdown_reservoir_time_default() const
void set_shroud_game(bool val)
configure_engine
void set_mp_countdown_reservoir_time(int val)
void set_shuffle_sides(bool val)
int num_turns_default() const
int mp_countdown_init_time() const
bool use_map_settings_default() const
bool use_map_settings() const
const std::vector< std::string > & entry_point_titles() const
bool registered_users_only() const
void set_mp_countdown_turn_bonus(int val)
int mp_countdown_action_bonus() const
bool random_start_time() const
int xp_modifier_default() const
const mp_game_settings & get_parameters() const
configure_engine(saved_game &state)
GLuint const GLfloat * val
Definition: glew.h:2614
bool random_start_time_default() const
mp_game_settings & parameters_
int mp_countdown_reservoir_time() const
void set_random_start_time(bool val)
bool fog_game_default() const
void set_village_gold(int val)
void set_use_map_settings(bool val)
bool allow_observers() const
int mp_countdown_init_time_default() const
void set_game_name(std::string name)
bool shuffle_sides_default() const
bool allow_observers_default() const
std::string game_name_default() const
void set_village_support(int val)
mp_game_settings::RANDOM_FACTION_MODE random_faction_mode_default() const
const config & options_default() const
void set_oos_debug(bool val)
void set_mp_countdown(bool val)
void set_fog_game(bool val)
void set_mp_countdown_action_bonus(int val)
bool shuffle_sides() const
bool force_lock_settings() const
std::string game_name() const
void set_allow_observers(bool val)
int village_gold_default() const
int mp_countdown_turn_bonus_default() const
void set_mp_countdown_init_time(int val)
bool registered_users_only_default() const
void set_num_turns(int val)
std::vector< const config * > entry_points_
mp_game_settings::RANDOM_FACTION_MODE random_faction_mode() const
GLuint const GLchar * name
Definition: glew.h:1782
void set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE val)
int village_support() const
std::vector< std::string > entry_point_titles_
void set_scenario(size_t scenario_num)
bool shroud_game_default() const
bool mp_countdown() const
bool mp_countdown_default() const
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
void set_xp_modifier(int val)
GLsizei const GLcharARB ** string
Definition: glew.h:4503
const config & options() const
int mp_countdown_action_bonus_default() const
int village_support_default() const
int mp_countdown_turn_bonus() const
void set_options(const config &cfg)