C++ Joueur Client
 All Classes Namespaces Functions Variables
game.hpp
1 #ifndef GAMES_CATASTROPHE_GAME_H
2 #define GAMES_CATASTROPHE_GAME_H
3 
4 // Game
5 // Convert as many humans to as you can to survive in this post-apocalyptic wasteland.
6 
7 // DO NOT MODIFY THIS FILE
8 // Never try to directly create an instance of this class, or modify its member variables.
9 // Instead, you should only be reading its variables and calling its functions.
10 
11 #include <vector>
12 #include <queue>
13 #include <deque>
14 #include <unordered_map>
15 #include <string>
16 #include <initializer_list>
17 
18 #include "../../joueur/src/any.hpp"
19 
20 
21 #include "../../joueur/src/base_game.hpp"
22 #include "impl/catastrophe_fwd.hpp"
23 
24 // <<-- Creer-Merge: includes -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
25 // you can add additional #includes here
26 // <<-- /Creer-Merge: includes -->>
27 
28 namespace cpp_client
29 {
30 
39 namespace catastrophe
40 {
41 
45 class Game : public Base_game
46 {
47 public:
48 
52  const double& cat_energy_mult;
53 
58 
62  const int& current_turn;
63 
67  const std::unordered_map<std::string, Game_object>& game_objects;
68 
72  const int& harvest_cooldown;
73 
77  const std::vector<Job>& jobs;
78 
83 
87  const int& map_height;
88 
92  const int& map_width;
93 
97  const int& max_turns;
98 
102  const double& monument_cost_mult;
103 
107  const int& monument_materials;
108 
112  const int& neutral_materials;
113 
117  const std::vector<Player>& players;
118 
122  const std::string& session;
123 
127  const int& shelter_materials;
128 
132  const int& starting_food;
133 
137  const double& starving_energy_mult;
138 
142  const std::vector<Structure>& structures;
143 
147  const std::vector<Tile>& tiles;
148 
153 
158 
163 
168 
172  const std::vector<Unit>& units;
173 
177  const int& wall_materials;
178 
179  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
180  // You can add additional member variables here. None of them will be tracked or updated by the server.
181  // <<-- /Creer-Merge: member variables -->>
182 
183 
190  Tile get_tile_at(const int x, const int y);
191 
192  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
193  // You can add additional methods here.
194  // <<-- /Creer-Merge: methods -->>
195 
196  ~Game_();
197 
198  // ####################
199  // Don't edit these!
200  // ####################
202  Game_(std::initializer_list<std::pair<std::string, Any&&>> init);
203  Game_() : Game_({}){}
204  virtual void resize(const std::string& name, std::size_t size) override;
205  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
206  virtual void remove_key(const std::string& name, Any& key) override;
207  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
208  virtual bool is_map(const std::string& name) override;
209  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
211  // ####################
212  // Don't edit these!
213  // ####################
214 };
215 
216 } // catastrophe
217 
218 } // cpp_client
219 
220 #endif // GAMES_CATASTROPHE_GAME_H
const int & turns_between_harvests
After a food tile is harvested, the number of turns before it can be harvested again.
Definition: game.hpp:157
const int & starting_food
The amount of food Players start with.
Definition: game.hpp:132
const std::vector< Job > & jobs
All the Jobs that Units can have in the game.
Definition: game.hpp:77
const int & lower_harvest_amount
The amount that the harvest rate is lowered each season.
Definition: game.hpp:82
const std::string & session
A unique identifier for the game instance that is being played.
Definition: game.hpp:122
const std::vector< Structure > & structures
Every Structure in the game.
Definition: game.hpp:142
Convert as many humans to as you can to survive in this post-apocalyptic wasteland.
Definition: game.hpp:45
const int & monument_materials
The number of materials in a monument.
Definition: game.hpp:107
const double & starving_energy_mult
The multiplier for the amount of energy regenerated when resting while starving.
Definition: game.hpp:137
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const std::unordered_map< std::string, Game_object > & game_objects
A mapping of every game object's ID to the actual game object. Primarily used by the server and clien...
Definition: game.hpp:67
const std::vector< Player > & players
List of all the players in the game.
Definition: game.hpp:117
const int & map_width
The number of Tiles in the map along the x (horizontal) axis.
Definition: game.hpp:92
const double & cat_energy_mult
The multiplier for the amount of energy regenerated when resting in a shelter with the cat overlord...
Definition: game.hpp:52
const int & harvest_cooldown
The amount of turns it takes for a Tile that was just harvested to grow food again.
Definition: game.hpp:72
const int & current_turn
The current turn number, starting at 0 for the first player's turn.
Definition: game.hpp:62
const double & monument_cost_mult
The multiplier for the cost of actions when performing them in range of a monument. Does not effect pickup cost.
Definition: game.hpp:102
const std::vector< Unit > & units
Every Unit in the game.
Definition: game.hpp:172
const int & max_turns
The maximum number of turns before the game will automatically end.
Definition: game.hpp:97
const int & turns_to_lower_harvest
The number of turns before the harvest rate is lowered (length of each season basically).
Definition: game.hpp:167
const int & neutral_materials
The number of materials in a neutral Structure.
Definition: game.hpp:112
const int & shelter_materials
The number of materials in a shelter.
Definition: game.hpp:127
const int & wall_materials
The number of materials in a wall.
Definition: game.hpp:177
Tile get_tile_at(const int x, const int y)
Gets the Tile at a specified (x, y) position
const int & time_added_per_turn
The amount of time (in nano-seconds) added after each player performs a turn.
Definition: game.hpp:152
const std::vector< Tile > & tiles
All the tiles in the map, stored in Row-major order. Use x + y * mapWidth to access the correct index...
Definition: game.hpp:147
const Player & current_player
The player whose turn it is currently. That player can send commands. Other players cannot...
Definition: game.hpp:57
const int & turns_to_create_human
The number of turns between fresh humans being spawned on the road.
Definition: game.hpp:162
A player in this game. Every AI controls one player.
Definition: player.hpp:37
const int & map_height
The number of Tiles in the map along the y (vertical) axis.
Definition: game.hpp:87