C++ Joueur Client
 All Classes Namespaces Functions Variables
tile.hpp
1 #ifndef GAMES_NECROWAR_TILE_H
2 #define GAMES_NECROWAR_TILE_H
3 
4 // Tile
5 // A Tile in the game that makes up the 2D map grid.
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 #include "game_object.hpp"
21 
22 #include "impl/necrowar_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 
31 namespace necrowar
32 {
33 
37 class Tile : public Game_object
38 {
39 public:
40 
44  const int& corpses;
45 
49  const bool& is_castle;
50 
54  const bool& is_gold_mine;
55 
59  const bool& is_grass;
60 
64  const bool& is_island_gold_mine;
65 
69  const bool& is_path;
70 
74  const bool& is_river;
75 
79  const bool& is_tower;
80 
84  const bool& is_unit_spawn;
85 
89  const bool& is_wall;
90 
94  const bool& is_worker_spawn;
95 
99  const int& num_ghouls;
100 
104  const int& num_hounds;
105 
109  const int& num_zombies;
110 
114  const Player& owner;
115 
119  const Tile& tile_east;
120 
124  const Tile& tile_north;
125 
129  const Tile& tile_south;
130 
134  const Tile& tile_west;
135 
139  const Tower& tower;
140 
144  const Unit& unit;
145 
149  const int& x;
150 
154  const int& y;
155 
156  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
157  // You can add additional member variables here. None of them will be tracked or updated by the server.
158  // <<-- /Creer-Merge: member variables -->>
159 
160 
165  bool res(int num);
166 
171  bool spawn_unit(const std::string& title);
172 
176  bool spawn_worker();
177 
181  static const std::vector<std::string> directions;
182 
187  std::vector<Tile> get_neighbors();
188 
193  bool is_pathable();
194 
200  bool has_neighbor(const Tile& tile);
201 
202  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
203  // You can add additional methods here.
204  // <<-- /Creer-Merge: methods -->>
205 
206  ~Tile_();
207 
208  // ####################
209  // Don't edit these!
210  // ####################
212  Tile_(std::initializer_list<std::pair<std::string, Any&&>> init);
213  Tile_() : Tile_({}){}
214  virtual void resize(const std::string& name, std::size_t size) override;
215  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
216  virtual void remove_key(const std::string& name, Any& key) override;
217  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
218  virtual bool is_map(const std::string& name) override;
219  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
221  // ####################
222  // Don't edit these!
223  // ####################
224 };
225 
226 } // necrowar
227 
228 } // cpp_client
229 
230 #endif // GAMES_NECROWAR_TILE_H
const bool & is_castle
Whether or not the tile is a castle tile.
Definition: tile.hpp:49
const int & y
The y (vertical) position of this Tile.
Definition: tile.hpp:154
bool res(int num)
resurrect the corpses on this tile into _zombies.
const bool & is_path
Whether or not the tile is considered a path or not (Units can walk on paths).
Definition: tile.hpp:69
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const int & num_hounds
The amount of Hounds on this tile.
Definition: tile.hpp:104
const bool & is_unit_spawn
Whether or not the tile is the unit spawn.
Definition: tile.hpp:84
const bool & is_worker_spawn
Whether or not the tile is the worker spawn.
Definition: tile.hpp:94
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
bool spawn_unit(const std::string &title)
spawns a fighting unit on the correct tile.
bool is_pathable()
Checks if a Tile is pathable to units
A player in this game. Every AI controls one player.
Definition: player.hpp:37
const bool & is_river
Whether or not the tile is considered a river or not.
Definition: tile.hpp:74
const bool & is_grass
Whether or not the tile is considered grass or not (Workers can walk on grass).
Definition: tile.hpp:59
const Tile & tile_east
The Tile to the 'East' of this one (x+1, y). Null if out of bounds of the map.
Definition: tile.hpp:119
static const std::vector< std::string > directions
The list of all valid directions Tiles can be in
Definition: tile.hpp:181
const Tile & tile_south
The Tile to the 'South' of this one (x, y+1). Null if out of bounds of the map.
Definition: tile.hpp:129
const bool & is_gold_mine
Whether or not the tile is considered to be a gold mine or not.
Definition: tile.hpp:54
A tower in the game. Used to combat enemy waves.
Definition: tower.hpp:37
const Tower & tower
The Tower on this Tile if present, otherwise null.
Definition: tile.hpp:139
const bool & is_tower
Whether or not the tile is considered a tower or not.
Definition: tile.hpp:79
const bool & is_island_gold_mine
Whether or not the tile is considered to be the island gold mine or not.
Definition: tile.hpp:64
std::vector< Tile > get_neighbors()
Gets the neighbors of this Tile
const Tile & tile_west
The Tile to the 'West' of this one (x-1, y). Null if out of bounds of the map.
Definition: tile.hpp:134
bool has_neighbor(const Tile &tile)
Checks if this Tile has a specific neighboring Tile
A unit in the game. May be a worker, zombie, ghoul, hound, abomination, wraith or horseman...
Definition: unit.hpp:37
const Unit & unit
The Unit on this Tile if present, otherwise null.
Definition: tile.hpp:144
const int & corpses
The amount of corpses on this tile.
Definition: tile.hpp:44
bool spawn_worker()
spawns a worker on the correct tile.
const int & x
The x (horizontal) position of this Tile.
Definition: tile.hpp:149
const Tile & tile_north
The Tile to the 'North' of this one (x, y-1). Null if out of bounds of the map.
Definition: tile.hpp:124
const int & num_ghouls
The amount of Ghouls on this tile.
Definition: tile.hpp:99
const bool & is_wall
Whether or not the tile can be moved on by workers.
Definition: tile.hpp:89
const Player & owner
Which player owns this tile, only applies to grass tiles for workers, NULL otherwise.
Definition: tile.hpp:114
const int & num_zombies
The amount of Zombies on this tile.
Definition: tile.hpp:109