Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MapNode.cxx
Go to the documentation of this file.
1 #include <cstdlib>
2 #include "MapNode.hxx"
3 
4 #include "LOG.hxx"
5 #include "../map/MapLayers.hxx"
6 #include "GameStates.hxx"
7 #include "Settings.hxx"
8 
9 MapNode::MapNode(Point isoCoordinates, const std::string &terrainID, const std::string &tileID)
10  : m_isoCoordinates(std::move(isoCoordinates)), m_sprite{std::make_unique<Sprite>(m_isoCoordinates)},
12  m_mapNodeData{std::vector(LAYERS_COUNT, MapNodeData{"", nullptr, 0, m_isoCoordinates, TileMap::DEFAULT})},
13  m_autotileBitmask(LAYERS_COUNT)
14 {
15  setTileID(terrainID, isoCoordinates);
16  if (!tileID.empty()) // in case tileID is not supplied skip it
17  {
18  setTileID(tileID, isoCoordinates);
19  }
20  // always add blueprint tiles too when creating the node
21  setTileID("terrain_blueprint", isoCoordinates);
22  const Layer layer = TileManager::instance().getTileLayer(tileID);
23  updateTexture(layer);
24 }
25 
26 bool MapNode::changeHeight(const bool higher)
27 {
28  constexpr int minHeight = 0;
29  auto &height = m_isoCoordinates.height;
30 
31  if ((higher && (height < maxHeight)) || (!higher && (height > minHeight)))
32  {
33  higher ? ++height : --height;
34  m_sprite->isoCoordinates = m_isoCoordinates;
35  return true;
36  }
37 
38  return false;
39 }
40 
41 void MapNode::render() const { m_sprite->render(); }
42 
43 void MapNode::setBitmask(unsigned char elevationBitmask, std::vector<uint8_t> autotileBitmask)
44 {
45  m_elevationBitmask = elevationBitmask;
46  m_autotileBitmask = autotileBitmask;
47  updateTexture();
48 }
49 
50 void MapNode::setTileID(const std::string &tileID, const Point &origCornerPoint)
51 {
52  TileData *tileData = TileManager::instance().getTileData(tileID);
53  if (tileData && !tileID.empty())
54  {
55  const Layer layer = TileManager::instance().getTileLayer(tileID);
56  switch (layer)
57  {
58  case Layer::ZONE:
59  this->setNodeTransparency(Settings::instance().zoneLayerTransparency, Layer::ZONE);
60  break;
61  case Layer::WATER:
63  //TODO: we need to modify neighbors TileTypes to Shore.
64  // no break on purpose.
65  case Layer::ROAD:
66  // in case it's allowed then maybe a Tree Tile already exist, so we remove it.
68  case Layer::POWERLINES:
69  break;
70  case Layer::BUILDINGS:
71  if (tileData->tileType != +TileType::FLORA)
72  {
74  }
75  m_sprite->setRenderFlag(Layer::ZONE, false);
76  break;
77  default:
78  break;
79  }
80 
81  m_mapNodeData[layer].origCornerPoint = origCornerPoint;
82  m_previousTileID = m_mapNodeData[layer].tileID;
83  m_mapNodeData[layer].tileData = tileData;
84  m_mapNodeData[layer].tileID = tileID;
85 
86  // Determine if the tile should have a random rotation or not.
87  if (m_mapNodeData[layer].tileData->tiles.pickRandomTile && m_mapNodeData[layer].tileData->tiles.count > 1)
88  {
92  m_mapNodeData[layer].tileIndex = rand() % m_mapNodeData[layer].tileData->tiles.count;
93  }
94  else
95  {
99  m_mapNodeData[layer].tileIndex = 0;
100  }
101  updateTexture(layer);
102  }
103 }
104 
106 {
107  for (auto currentLayer : layersInActiveOrder)
108  {
109  if (MapLayers::isLayerActive(currentLayer) && m_mapNodeData[currentLayer].tileData)
110  {
111  return currentLayer;
112  }
113  }
114  return Layer::NONE;
115 }
116 
117 void MapNode::setNodeTransparency(const float transparencyFactor, const Layer &layer) const
118 {
119  // TODO refactoring: Consider replacing magic number (255) with constexpr.
120  unsigned char alpha = (1 - transparencyFactor) * 255;
121  m_sprite->setSpriteTranparencyFactor(layer, alpha);
122 }
123 
124 bool MapNode::isPlacableOnSlope(const std::string &tileID) const
125 {
126  TileData *tileData = TileManager::instance().getTileData(tileID);
127  if (tileData && tileData->tileType == +TileType::ZONE)
128  {
129  // zones are allowed to pass slopes.
130  return true;
131  }
133  {
134  // we need to check the terrain layer for it's orientation so we can calculate the resulting x offset in the spritesheet.
135  const int clipRectX = tileData->slopeTiles.clippingWidth * static_cast<int>(m_autotileOrientation[Layer::TERRAIN]);
136  // while loading game, m_previousTileID will be equal to "terrain" for terrin tiles while it's empty "" when starting new game.
137  // so the check here on m_previousTileID is needed both (temporary), empty and "terrain", this will be fixed in new PR.
138  if (clipRectX >= static_cast<int>(tileData->slopeTiles.count) * tileData->slopeTiles.clippingWidth &&
139  (m_previousTileID.empty() || m_previousTileID == "terrain"))
140  {
141  return false;
142  }
143  }
144  return true;
145 }
146 
147 bool MapNode::isPlacementAllowed(const std::string &newTileID) const
148 {
149  TileData *tileData = TileManager::instance().getTileData(newTileID);
150 
151  if (tileData)
152  {
153  const Layer layer = TileManager::instance().getTileLayer(newTileID);
154  // layer specific checks:
155  switch (layer)
156  {
157  case Layer::ZONE:
159  {
160  return tileData->placeOnWater;
161  }
162  return true;
163  case Layer::POWERLINES:
165  std::any_of(layersPowerlinesCanCross.begin(), layersPowerlinesCanCross.end(),
166  [this](const Layer &_layer) { return this->isLayerOccupied(_layer); }))
167  { // powerlines can be placed over each other and over other low terrains
168  return true;
169  }
170  case Layer::ROAD:
171  if ((isLayerOccupied(Layer::BUILDINGS) && (m_mapNodeData[Layer::BUILDINGS].tileData->category != "Flora")) ||
173  { // roads cannot be placed:
174  // - on buildings that are not category flora.
175  // - on water
176  // - on slopetiles that don't have a tileID
177  return false;
178  }
179  return true;
182  { // allow placement of ground decoration on existing ground decoration and on buildings.
183  return true;
184  }
185  break;
186  case Layer::FLORA:
187  if (m_mapNodeData[Layer::FLORA].tileData && m_mapNodeData[Layer::FLORA].tileData->isOverPlacable)
188  { // flora with overplacable flag
189  return true;
190  }
192  { // don't allow placement of flora on buildings or roads
193  return false;
194  }
195  break;
196  case Layer::BUILDINGS:
197  {
198  TileData *tileDataBuildings = m_mapNodeData[Layer::BUILDINGS].tileData;
199  if (tileDataBuildings && tileDataBuildings->isOverPlacable)
200  { // buildings with overplacable flag
201  return true;
202  }
204  { // buildings cannot be placed on roads
205  return false;
206  }
207  break;
208  }
209  default:
210  break;
211  }
212 
213  // checks for all layers:
215  {
216  if (tileData->tileType != +TileType::WATER && !tileData->placeOnWater)
217  // Disallow placement on water for tiles that are:
218  // not of tiletype water
219  // not flag placeOnWater enabled
220  {
221  return false;
222  }
223  }
224  else // not water
225  {
226  if (!tileData->placeOnGround)
227  // Disallow placement on ground (meaning a tile that is not water) for tiles that have:
228  // not flag placeOnGround enabled
229  {
230  return false;
231  }
232  }
233 
234  if (!isPlacableOnSlope(newTileID))
235  { // Check if a tile has slope frames and therefore can be placed on a node with a slope
236  return false;
237  }
238 
239  if (tileData->tileType == +TileType::UNDERGROUND)
240  { // Underground tiletype (pipes, metro tunnels, ... ) can overplace each other
241  return true;
242  }
243 
244  if (m_mapNodeData[layer].tileID.empty())
245  { // of course allow placement on empty tiles
246  return true;
247  }
248  }
249  // every case that is not handled is false
250  return false;
251 }
252 
253 void MapNode::updateTexture(const Layer &layer)
254 {
255  SDL_Rect clipRect{0, 0, 0, 0};
256  //TODO: Refactor this
258  std::vector<Layer> layersToGoOver;
259  if (layer != Layer::NONE)
260  {
261  // in case this is not the default value (which is NONE), we need to update only 1 layer.
262  layersToGoOver.push_back(layer);
263  }
264  else
265  {
266  layersToGoOver.insert(layersToGoOver.begin(), std::begin(allLayersOrdered), std::end(allLayersOrdered));
267  }
268 
269  for (auto currentLayer : layersToGoOver)
270  {
271  if (m_mapNodeData[currentLayer].tileData)
272  {
273  size_t spriteCount = 1;
274  m_mapNodeData[currentLayer].tileMap = TileMap::DEFAULT;
276  {
277  if (m_mapNodeData[currentLayer].tileData->tileType == +TileType::WATER ||
278  m_mapNodeData[currentLayer].tileData->tileType == +TileType::TERRAIN ||
279  m_mapNodeData[currentLayer].tileData->tileType == +TileType::BLUEPRINT)
280  {
282  m_mapNodeData[currentLayer].tileMap = TileMap::DEFAULT;
284  {
286  // for shore tiles, we need to reset the tileIndex to 0, else a random tile would be picked. This is a little bit hacky.
287  m_mapNodeData[Layer::TERRAIN].tileIndex = 0;
288  }
289  }
290  // if the node can autotile, calculate it's tile orientation
291  else if (TileManager::instance().isTileIDAutoTile(getTileID(currentLayer)))
292  {
294  }
295  }
297  {
298  if (m_mapNodeData[currentLayer].tileData->slopeTiles.fileName.empty())
299  {
300  m_mapNodeData[currentLayer].tileMap = TileMap::DEFAULT;
302  }
303  else
304  {
305  m_mapNodeData[currentLayer].tileMap = TileMap::SLOPES; // TileSlopes [N,E,w,S]
306  m_autotileOrientation[currentLayer] = static_cast<TileOrientation>(m_elevationOrientation);
307  }
308  }
309 
310  switch (m_mapNodeData[currentLayer].tileMap)
311  {
312  case TileMap::DEFAULT:
313  m_clippingWidth = m_mapNodeData[currentLayer].tileData->tiles.clippingWidth;
314  if (m_mapNodeData[currentLayer].tileIndex != 0)
315  {
316  clipRect.x = m_clippingWidth * m_mapNodeData[currentLayer].tileIndex;
317  }
318  else
319  {
320  if (m_mapNodeData[currentLayer].tileData->tileType == +TileType::POWERLINE &&
321  std::any_of(layersPowerlinesCanCross.begin(), layersPowerlinesCanCross.end(),
322  [this](const Layer &_layer) { return this->m_mapNodeData[_layer].tileData; }))
323  { // if we place a power line cross low terrain (eg, roads, water, flora)
324  switch (m_autotileOrientation[currentLayer])
325  {
328  break;
331  break;
332  default:
333  break;
334  }
335  }
336  // only check for rectangular roads when there are frames for it. Spritesheets with rect-roads have 20 items
337  if (GameStates::instance().rectangularRoads && m_mapNodeData[currentLayer].tileData->tiles.count == 20)
338  {
339  switch (m_autotileOrientation[currentLayer])
340  {
343  break;
346  break;
349  break;
352  break;
353 
354  default:
355  break;
356  }
357  }
358  clipRect.x = m_clippingWidth * static_cast<int>(m_autotileOrientation[currentLayer]);
359  }
360 
361  if (!m_mapNodeData[currentLayer].tileID.empty())
362  {
363  m_sprite->setClipRect({clipRect.x + m_clippingWidth * m_mapNodeData[currentLayer].tileData->tiles.offset, 0,
364  m_clippingWidth, m_mapNodeData[currentLayer].tileData->tiles.clippingHeight},
365  static_cast<Layer>(currentLayer));
366  m_sprite->setTexture(TileManager::instance().getTexture(m_mapNodeData[currentLayer].tileID),
367  static_cast<Layer>(currentLayer));
368  }
369 
370  spriteCount = m_mapNodeData[currentLayer].tileData->tiles.count;
371  break;
372  case TileMap::SHORE:
373  m_clippingWidth = m_mapNodeData[currentLayer].tileData->shoreTiles.clippingWidth;
374  if (m_mapNodeData[currentLayer].tileIndex != 0)
375  {
376  clipRect.x = m_clippingWidth * m_mapNodeData[currentLayer].tileIndex;
377  }
378  else
379  {
380  clipRect.x = m_clippingWidth * static_cast<int>(m_autotileOrientation[currentLayer]);
381  }
382 
383  if (!m_mapNodeData[currentLayer].tileID.empty())
384  {
385  m_sprite->setClipRect({clipRect.x + m_clippingWidth * m_mapNodeData[currentLayer].tileData->shoreTiles.offset, 0,
386  m_clippingWidth, m_mapNodeData[currentLayer].tileData->shoreTiles.clippingHeight},
387  static_cast<Layer>(currentLayer));
388  m_sprite->setTexture(TileManager::instance().getTexture(m_mapNodeData[currentLayer].tileID + "_shore"),
389  static_cast<Layer>(currentLayer));
390  }
391 
392  spriteCount = m_mapNodeData[currentLayer].tileData->shoreTiles.count;
393  break;
394  case TileMap::SLOPES:
395  if (m_mapNodeData[currentLayer].tileData->slopeTiles.fileName.empty())
396  {
397  break;
398  }
399  m_clippingWidth = m_mapNodeData[currentLayer].tileData->slopeTiles.clippingWidth;
400  clipRect.x = m_mapNodeData[currentLayer].tileData->slopeTiles.clippingWidth *
401  static_cast<int>(m_autotileOrientation[currentLayer]);
402  spriteCount = m_mapNodeData[currentLayer].tileData->slopeTiles.count;
403  if (clipRect.x <= static_cast<int>(spriteCount) * m_clippingWidth)
404  {
405  m_sprite->setClipRect({clipRect.x + m_mapNodeData[currentLayer].tileData->slopeTiles.offset * m_clippingWidth, 0,
406  m_clippingWidth, m_mapNodeData[currentLayer].tileData->slopeTiles.clippingHeight},
407  static_cast<Layer>(currentLayer));
408  m_sprite->setTexture(TileManager::instance().getTexture(m_mapNodeData[currentLayer].tileID),
409  static_cast<Layer>(currentLayer));
410  }
411  break;
412  default:
413  break;
414  }
415 
416  if (clipRect.x >= static_cast<int>(spriteCount) * m_clippingWidth)
417  {
418  m_mapNodeData[currentLayer].tileID = m_previousTileID;
419  if (m_previousTileID.empty())
420  {
421  m_mapNodeData[currentLayer].tileData = nullptr;
422  }
423  updateTexture(currentLayer);
424  }
425  m_sprite->spriteCount = spriteCount;
426  }
427  }
428 }
429 
431 
432 void MapNode::setCoordinates(const Point &newIsoCoordinates)
433 {
434  m_isoCoordinates = newIsoCoordinates;
435  m_sprite->isoCoordinates = m_isoCoordinates;
436 }
437 
439 
440 void MapNode::setMapNodeData(std::vector<MapNodeData> &&mapNodeData)
441 {
442  m_mapNodeData.swap(mapNodeData);
443  this->setNodeTransparency(Settings::instance().zoneLayerTransparency, Layer::ZONE);
444 
445  // updates the pointers to the tiles, after loading tileIDs from json
446  for (auto &it : m_mapNodeData)
447  {
448  delete it.tileData;
449 
450  it.tileData = TileManager::instance().getTileData(it.tileID);
451  }
452 }
453 
454 void MapNode::demolishLayer(const Layer &layer)
455 {
456  m_mapNodeData[layer].tileData = nullptr;
457  m_mapNodeData[layer].tileID = "";
458  m_autotileOrientation[layer] =
459  TileOrientation::TILE_DEFAULT_ORIENTATION; // We need to reset TileOrientation, in case it's set (demolishing autotiles)
460  m_mapNodeData[layer].origCornerPoint = this->getCoordinates();
461  m_sprite->setRenderFlag(Layer::ZONE, true);
462  m_sprite->clearSprite(layer);
463 }
464 
465 void MapNode::demolishNode(const Layer &demolishLayer)
466 {
467  // allow to delete a single layer only
468  std::vector<Layer> layersToDemolish;
469  if (demolishLayer == Layer::NONE)
470  {
473  }
474  else
475  {
476  layersToDemolish.push_back(demolishLayer);
477  }
478 
479  for (auto &layer : layersToDemolish)
480  {
481  if (MapLayers::isLayerActive(layer) && m_mapNodeData[layer].tileData)
482  {
484  m_mapNodeData[layer].tileData->tileType == +TileType::ZONE) ||
486  m_mapNodeData[layer].tileData->tileType != +TileType::ZONE) ||
488  m_mapNodeData[layer].tileData->tileType != +TileType::GROUNDDECORATION))
489  {
490  continue;
491  }
492  this->demolishLayer(layer);
493  if (layer == Layer::BUILDINGS)
494  {
496  }
497  updateTexture(demolishLayer);
498  }
499  }
500 }
501 
502 const bool MapNode::isConductive() const
503 {
505  {
506  return true;
507  }
508  else
509  {
510  return false;
511  }
512 }
demolishMode
bool demolishMode
Definition: mapEdit.cxx:5
DemolishMode::DE_ZONE
@ DE_ZONE
Remove only zones.
TileData::placeOnWater
bool placeOnWater
whether or not this building is placeable on water
Definition: tileData.hxx:162
TileManager::calculateTileOrientation
TileOrientation calculateTileOrientation(unsigned char bitMaskElevation)
Calculates the TileOrientation for elevated tiles to pick the correct Sprite.
Definition: TileManager.cxx:257
WATER
@ WATER
6- Water tiles
Definition: enums.hxx:17
TileData::tileType
TileType tileType
Definition: tileData.hxx:149
DEFAULT
@ DEFAULT
Definition: TileManager.hxx:18
TILE_N_AND_W
@ TILE_N_AND_W
Definition: TileManager.hxx:49
TileData::placeOnGround
bool placeOnGround
whether or not this building is placeable on ground
Definition: tileData.hxx:161
TILE_S_AND_E_RECT
@ TILE_S_AND_E_RECT
Definition: TileManager.hxx:61
MapNode::getCoordinates
const Point & getCoordinates() const
get iso coordinates of this node
Definition: MapNode.hxx:59
TileData::category
std::string category
The category this item resides in. Categories are used for the building menu in-game and for sorting ...
Definition: tileData.hxx:140
LOG.hxx
POWERLINES
@ POWERLINES
9- Powerlines
Definition: enums.hxx:20
BETWEEN
@ BETWEEN
Definition: TileManager.hxx:37
MapNode::getTopMostActiveLayer
Layer getTopMostActiveLayer() const
return topmost active layer.
Definition: MapNode.cxx:105
NONE
@ NONE
0- this must be FIRST !!!
Definition: enums.hxx:11
MapNode::isConductive
const bool isConductive() const
check the conductivity of the node
Definition: MapNode.cxx:502
MapNode::maxHeight
static const int maxHeight
Maximum height of the node.
Definition: MapNode.hxx:186
TILE_N_AND_S_CROSS
@ TILE_N_AND_S_CROSS
Definition: TileManager.hxx:64
TileManager::calculateSlopeOrientation
size_t calculateSlopeOrientation(unsigned char bitMaskElevation)
Calculates the slope orientation for elevated tiles to pick the correct slope Sprite.
Definition: TileManager.cxx:147
MapNode::isPlacementAllowed
bool isPlacementAllowed(const std::string &newTileID) const
Definition: MapNode.cxx:147
DemolishMode::GROUND_DECORATION
@ GROUND_DECORATION
Remove only ground decoration.
MapNode::getTileData
const TileData * getTileData(Layer layer) const
Definition: MapNode.hxx:84
MapNode::m_autotileOrientation
std::vector< TileOrientation > m_autotileOrientation
Definition: MapNode.hxx:192
MapNode::m_elevationBitmask
unsigned char m_elevationBitmask
Definition: MapNode.hxx:197
TILE_N_AND_E
@ TILE_N_AND_E
Definition: TileManager.hxx:46
MapNode::m_sprite
std::unique_ptr< Sprite > m_sprite
Definition: MapNode.hxx:190
TILE_N_AND_W_RECT
@ TILE_N_AND_W_RECT
Definition: TileManager.hxx:62
TILE_E_AND_W
@ TILE_E_AND_W
Definition: TileManager.hxx:48
MapNode::demolishLayer
void demolishLayer(const Layer &layer)
demolish specific layer of a Node.
Definition: MapNode.cxx:454
MapNode::updateTexture
void updateTexture(const Layer &layer=Layer::NONE)
Update texture.
Definition: MapNode.cxx:253
MapNode::demolishNode
void demolishNode(const Layer &layer=Layer::NONE)
Demolish a node.
Definition: MapNode.cxx:465
MapNode::render
void render() const
Render MapNode.
Definition: MapNode.cxx:41
TileData::tiles
TileSetData tiles
Tile Spritesheet information.
Definition: tileData.hxx:148
MapNode::isSlopeNode
bool isSlopeNode(void) const
check if current Node Terrain is Slope Terrain.
Definition: MapNode.cxx:430
MapNode.hxx
GameStates.hxx
TILE_E_AND_W_CROSS
@ TILE_E_AND_W_CROSS
Definition: TileManager.hxx:63
ZONE
@ ZONE
4- Optional layer, zones(Industrial/Residential/Commercial).
Definition: enums.hxx:15
BLUEPRINT
@ BLUEPRINT
1- Optional layer - Map Blueprint
Definition: enums.hxx:12
SHORE
@ SHORE
Definition: TileManager.hxx:20
BUILDINGS
@ BUILDINGS
8- Buildings, Streets and everything that goes on the terrain
Definition: enums.hxx:19
TileManager::getTileLayer
Layer getTileLayer(const std::string &tileID) const
Get the Layer that is associated with a tileID. The Tile will be placed on this layer.
Definition: TileManager.cxx:104
TILE_S_AND_E
@ TILE_S_AND_E
Definition: TileManager.hxx:52
MapNode::m_elevationOrientation
size_t m_elevationOrientation
Definition: MapNode.hxx:193
DEFAULT_ORIENTATION
@ DEFAULT_ORIENTATION
Definition: TileManager.hxx:38
TileManager::getTexture
SDL_Texture * getTexture(const std::string &tileID) const
Get the Texture for the tileID.
Definition: TileManager.cxx:17
GameStatesData::rectangularRoads
bool rectangularRoads
place rectangular road tiles instead of diagonal tiles
Definition: GameStates.hxx:15
TILE_S_AND_W_RECT
@ TILE_S_AND_W_RECT
Definition: TileManager.hxx:60
GameStatesData::demolishMode
DemolishMode demolishMode
Definition: GameStates.hxx:19
Settings.hxx
TileData::isOverPlacable
bool isOverPlacable
Determines if other tiles can be placed over this one tile.
Definition: tileData.hxx:163
MapNode::m_mapNodeData
std::vector< MapNodeData > m_mapNodeData
Definition: MapNode.hxx:195
FLORA
@ FLORA
10- Trees and other flora/Fauna tiles
Definition: enums.hxx:21
TileManager::getTileData
TileData * getTileData(const std::string &id) noexcept
Get the TileData struct for this tileID and all information associated with it.
Definition: TileManager.cxx:22
DemolishMode::DEFAULT
@ DEFAULT
Demolish everything, but not.
MapLayers::isLayerActive
static bool isLayerActive(unsigned int layer)
Check if given Layer is being drawn.
Definition: MapLayers.hxx:34
TileData::slopeTiles
TileSetData slopeTiles
Slope Tile Spritesheet information.
Definition: tileData.hxx:151
TERRAIN
@ TERRAIN
3- Terrain tiles, decorations, ... - must always be a "full" tile
Definition: enums.hxx:14
TileOrientation
TileOrientation
Definition: TileManager.hxx:41
MapNode::setNodeTransparency
void setNodeTransparency(const float transparencyFactor, const Layer &layer) const
Sets a node to be Transparent.
Definition: MapNode.cxx:117
TILE_S_AND_W
@ TILE_S_AND_W
Definition: TileManager.hxx:55
layersInActiveOrder
static Layer layersInActiveOrder[]
This is a ordered list of all relevant layers from the most active to the least active.
Definition: enums.hxx:34
Point::height
int height
The height level.
Definition: Point.hxx:26
MapNode::m_clippingWidth
int m_clippingWidth
Definition: MapNode.hxx:194
ROAD
@ ROAD
5- Optional layer, roads.
Definition: enums.hxx:16
MapNode::getTileID
const std::string & getTileID(Layer layer) const
get TileID of specific layer inside NodeData.
Definition: MapNode.hxx:89
MapNode::m_autotileBitmask
std::vector< unsigned char > m_autotileBitmask
Definition: MapNode.hxx:196
std
Definition: Point.hxx:83
TILE_N_AND_S
@ TILE_N_AND_S
Definition: TileManager.hxx:53
layersPowerlinesCanCross
const static std::vector< Layer > layersPowerlinesCanCross
Definition: enums.hxx:38
MapNode::m_previousTileID
std::string m_previousTileID
Definition: MapNode.hxx:191
MapNode::m_isoCoordinates
Point m_isoCoordinates
Definition: MapNode.hxx:189
Point
Definition: Point.hxx:7
allLayersOrdered
static Layer allLayersOrdered[]
This is a ordered list of all relevant layers we need to interact with.
Definition: enums.hxx:29
GROUND_DECORATION
@ GROUND_DECORATION
13- Decoration to place beneath buildings. Like concrete or grass
Definition: enums.hxx:24
Singleton< TileManager >::instance
static TileManager & instance(void)
Get an instance of the singleton.
Definition: Singleton.hxx:15
LAYERS_COUNT
@ LAYERS_COUNT
this must be LAST !!!
Definition: enums.hxx:25
MapNode::changeHeight
bool changeHeight(const bool higher)
Change Height.
Definition: MapNode.cxx:26
MapNode::MapNode
MapNode(Point isoCoordinates, const std::string &terrainID, const std::string &newTileID="")
Definition: MapNode.cxx:9
N
@ N
Definition: TileManager.hxx:25
MapNode::setMapNodeData
void setMapNodeData(std::vector< MapNodeData > &&mapNodeData)
Overwrite m_mapData with the one loaded from a savegame. This function to be used only by loadGame.
Definition: MapNode.cxx:440
TILE_N_AND_E_RECT
@ TILE_N_AND_E_RECT
Definition: TileManager.hxx:59
MapNode::isPlacableOnSlope
bool isPlacableOnSlope(const std::string &tileID) const
check if tileID placeable on slope tile.
Definition: MapNode.cxx:124
Layer
Layer
All Layers we have.
Definition: enums.hxx:9
MapNode::setBitmask
void setBitmask(unsigned char elevationBitmask, std::vector< uint8_t > tileTypeBitmask)
Definition: MapNode.cxx:43
string
std::string string
Definition: AudioConfig.hxx:14
UNDERGROUND
@ UNDERGROUND
2- Optional layer - Pipes, Subway-pipes and so onn
Definition: enums.hxx:13
MapNode::getActiveMapNodeData
const MapNodeData & getActiveMapNodeData() const
Definition: MapNode.cxx:438
MapNode::isLayerOccupied
bool isLayerOccupied(const Layer &layer) const
Definition: MapNode.hxx:155
TILE_DEFAULT_ORIENTATION
@ TILE_DEFAULT_ORIENTATION
Definition: TileManager.hxx:43
MapNodeData
Definition: MapNode.hxx:17
TileData
Holds all releavted information to this specific tile.
Definition: tileData.hxx:135
MapNode::setTileID
void setTileID(const std::string &tileType, const Point &origPoint)
Definition: MapNode.cxx:50
MapNode::setCoordinates
void setCoordinates(const Point &newIsoCoordinates)
sets the iso coordinates of this node
Definition: MapNode.cxx:432
SLOPES
@ SLOPES
Definition: TileManager.hxx:19