C++ Joueur Client
 All Classes Namespaces Functions Variables
tile.hpp
1 #ifndef GAMES_STUMPED_TILE_H
2 #define GAMES_STUMPED_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/stumped_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 stumped
32 {
33 
37 class Tile : public Game_object
38 {
39 public:
40 
44  const Beaver& beaver;
45 
49  const int& branches;
50 
54  const std::string& flow_direction;
55 
59  const int& food;
60 
65 
69  const Spawner& spawner;
70 
74  const Tile& tile_east;
75 
79  const Tile& tile_north;
80 
84  const Tile& tile_south;
85 
89  const Tile& tile_west;
90 
94  const std::string& type;
95 
99  const int& x;
100 
104  const int& y;
105 
106  // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
107  // You can add additional member variables here. None of them will be tracked or updated by the server.
108  // <<-- /Creer-Merge: member variables -->>
109 
110 
114  static const std::vector<std::string> directions;
115 
120  std::vector<Tile> get_neighbors();
121 
126  bool is_pathable();
127 
133  bool has_neighbor(const Tile& tile);
134 
135  // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
136  // You can add additional methods here.
137  // <<-- /Creer-Merge: methods -->>
138 
139  ~Tile_();
140 
141  // ####################
142  // Don't edit these!
143  // ####################
145  Tile_(std::initializer_list<std::pair<std::string, Any&&>> init);
146  Tile_() : Tile_({}){}
147  virtual void resize(const std::string& name, std::size_t size) override;
148  virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override;
149  virtual void remove_key(const std::string& name, Any& key) override;
150  virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override;
151  virtual bool is_map(const std::string& name) override;
152  virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override;
154  // ####################
155  // Don't edit these!
156  // ####################
157 };
158 
159 } // stumped
160 
161 } // cpp_client
162 
163 #endif // GAMES_STUMPED_TILE_H
const Player & lodge_owner
The owner of the Beaver lodge on this Tile, if present, otherwise null.
Definition: tile.hpp:64
const int & food
The number of food dropped on this Tile.
Definition: tile.hpp:59
bool is_pathable()
Checks if a Tile is pathable to units
const Beaver & beaver
The Beaver on this Tile if present, otherwise null.
Definition: tile.hpp:44
bool has_neighbor(const Tile &tile)
Checks if this Tile has a specific neighboring Tile
const int & branches
The number of branches dropped on this Tile.
Definition: tile.hpp:49
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:84
const int & y
The y (vertical) position of this Tile.
Definition: tile.hpp:104
A player in this game. Every AI controls one player.
Definition: player.hpp:37
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:74
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
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:79
static const std::vector< std::string > directions
The list of all valid directions Tiles can be in
Definition: tile.hpp:114
A beaver in the game.
Definition: beaver.hpp:37
const std::string & type
What type of Tile this is, either 'water' or 'land'.
Definition: tile.hpp:94
std::vector< Tile > get_neighbors()
Gets the neighbors of this Tile
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
A resource spawner that generates branches or food.
Definition: spawner.hpp:37
const Spawner & spawner
The resource Spawner on this Tile if present, otherwise null.
Definition: tile.hpp:69
const std::string & flow_direction
The cardinal direction water is flowing on this Tile ('North', 'East', 'South', 'West').
Definition: tile.hpp:54
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:89
const int & x
The x (horizontal) position of this Tile.
Definition: tile.hpp:99