FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
layer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 // Standard C++ library includes
23 
24 // 3rd party library includes
25 
26 // FIFE includes
27 // These includes are split up in two parts, separated by one empty line
28 // First block: files included from the FIFE root src directory
29 // Second block: files included from the same folder
30 #include "util/log/logger.h"
31 #include "util/structures/purge.h"
33 
34 #include "layer.h"
35 #include "instance.h"
36 #include "map.h"
37 #include "instancetree.h"
38 #include "cell.h"
39 #include "cellcache.h"
40 
41 namespace FIFE {
45  static Logger _log(LM_STRUCTURES);
46 
47  Layer::Layer(const std::string& identifier, Map* map, CellGrid* grid)
48  : m_id(identifier),
49  m_map(map),
50  m_instancesVisibility(true),
51  m_transparency(0),
52  m_instanceTree(new InstanceTree()),
53  m_grid(grid),
54  m_pathingStrategy(CELL_EDGES_ONLY),
55  m_sortingStrategy(SORTING_CAMERA),
56  m_walkable(false),
57  m_interact(false),
58  m_walkableId(""),
59  m_cellCache(NULL),
60  m_changeListeners(),
61  m_changedInstances(),
62  m_changed(false),
63  m_static(false) {
64  }
65 
67  // if this is a walkable layer
69  // if this is a interact layer
70  if (m_interact) {
71  Layer* temp = m_map->getLayer(m_walkableId);
72  if (temp) {
73  temp->removeInteractLayer(this);
74  }
75  }
77  delete m_instanceTree;
78  }
79 
80  const std::string& Layer::getId() const {
81  return m_id;
82  }
83 
84  void Layer::setId(const std::string& id) {
85  m_id = id;
86  }
87 
88  Map* Layer::getMap() const {
89  return m_map;
90  }
91 
93  return m_grid;
94  }
95 
97  m_grid = grid;
98  }
99 
101  return m_instanceTree;
102  }
103 
104  bool Layer::hasInstances() const {
105  return !m_instances.empty();
106  }
107 
108  Instance* Layer::createInstance(Object* object, const ModelCoordinate& p, const std::string& id) {
109  ExactModelCoordinate emc(static_cast<double>(p.x), static_cast<double>(p.y), static_cast<double>(p.z));
110  return createInstance(object, emc, id);
111  }
112 
113  Instance* Layer::createInstance(Object* object, const ExactModelCoordinate& p, const std::string& id) {
114  Location location(this);
115  location.setExactLayerCoordinates(p);
116 
117  Instance* instance = new Instance(object, location, id);
118  if(instance->isActive()) {
119  setInstanceActivityStatus(instance, instance->isActive());
120  }
121  m_instances.push_back(instance);
122  m_instanceTree->addInstance(instance);
123 
124  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
125  while (i != m_changeListeners.end()) {
126  (*i)->onInstanceCreate(this, instance);
127  ++i;
128  }
129  m_changed = true;
130  return instance;
131  }
132 
134  if( !instance ){
135  FL_ERR(_log, "Tried to add an instance to layer, but given instance is invalid");
136  return false;
137  }
138 
139  Location& location = instance->getLocationRef();
140  location.setLayer(this);
141  location.setExactLayerCoordinates(p);
142 
143  m_instances.push_back(instance);
144  m_instanceTree->addInstance(instance);
145  if(instance->isActive()) {
146  setInstanceActivityStatus(instance, instance->isActive());
147  }
148 
149  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
150  while (i != m_changeListeners.end()) {
151  (*i)->onInstanceCreate(this, instance);
152  ++i;
153  }
154  m_changed = true;
155  return true;
156  }
157 
158  void Layer::removeInstance(Instance* instance) {
159  // If the instance is changed and removed on the same pump,
160  // it can happen that the instance can not cleanly be removed,
161  // to avoid this we have to update the instance first and send
162  // the result to the LayerChangeListeners.
163  if (instance->isActive()) {
164  if (instance->update() != ICHANGE_NO_CHANGES) {
165  std::vector<Instance*> updateInstances;
166  updateInstances.push_back(instance);
167  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
168  while (i != m_changeListeners.end()) {
169  (*i)->onLayerChanged(this, updateInstances);
170  ++i;
171  }
172  }
173  }
174 
175  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
176  while (i != m_changeListeners.end()) {
177  (*i)->onInstanceDelete(this, instance);
178  ++i;
179  }
180  setInstanceActivityStatus(instance, false);
181  std::vector<Instance*>::iterator it = m_instances.begin();
182  for(; it != m_instances.end(); ++it) {
183  if(*it == instance) {
185  m_instances.erase(it);
186  break;
187  }
188  }
189  m_changed = true;
190  }
191 
192  void Layer::deleteInstance(Instance* instance) {
193  // If the instance is changed and deleted on the same pump,
194  // it can happen that the instance can not cleanly be removed,
195  // to avoid this we have to update the instance first and send
196  // the result to the LayerChangeListeners.
197  if (instance->isActive()) {
198  if (instance->update() != ICHANGE_NO_CHANGES) {
199  std::vector<Instance*> updateInstances;
200  updateInstances.push_back(instance);
201  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
202  while (i != m_changeListeners.end()) {
203  (*i)->onLayerChanged(this, updateInstances);
204  ++i;
205  }
206  }
207  }
208 
209  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
210  while (i != m_changeListeners.end()) {
211  (*i)->onInstanceDelete(this, instance);
212  ++i;
213  }
214  setInstanceActivityStatus(instance, false);
215  std::vector<Instance*>::iterator it = m_instances.begin();
216  for(; it != m_instances.end(); ++it) {
217  if(*it == instance) {
219  delete *it;
220  m_instances.erase(it);
221  break;
222  }
223  }
224 
225  m_changed = true;
226  }
227 
228  const std::vector<Instance*>& Layer::getInstances() const {
229  return m_instances;
230  }
231 
232  void Layer::setInstanceActivityStatus(Instance* instance, bool active) {
233  if(active) {
234  m_activeInstances.insert(instance);
235  } else {
236  m_activeInstances.erase(instance);
237  }
238  }
239 
240  Instance* Layer::getInstance(const std::string& id) {
241  std::vector<Instance*>::iterator it = m_instances.begin();
242  for(; it != m_instances.end(); ++it) {
243  if((*it)->getId() == id)
244  return *it;
245  }
246 
247  return 0;
248  }
249 
250  std::vector<Instance*> Layer::getInstances(const std::string& id) {
251  std::vector<Instance*> matching_instances;
252  std::vector<Instance*>::iterator it = m_instances.begin();
253  for(; it != m_instances.end(); ++it) {
254  if((*it)->getId() == id)
255  matching_instances.push_back(*it);
256  }
257  return matching_instances;
258  }
259 
260  std::vector<Instance*> Layer::getInstancesAt(Location& loc, bool use_exactcoordinates) {
261  std::vector<Instance*> matching_instances;
262  std::vector<Instance*>::iterator it = m_instances.begin();
263 
264  for(; it != m_instances.end(); ++it) {
265  if (use_exactcoordinates) {
266  if ((*it)->getLocationRef().getExactLayerCoordinatesRef() == loc.getExactLayerCoordinatesRef()) {
267  matching_instances.push_back(*it);
268  }
269  } else {
270  if ((*it)->getLocationRef().getLayerCoordinates() == loc.getLayerCoordinates()) {
271  matching_instances.push_back(*it);
272  }
273  }
274  }
275 
276  return matching_instances;
277  }
278 
279  std::list<Instance*> Layer::getInstancesIn(Rect& rec) {
280  std::list<Instance*> matching_instances;
281  ModelCoordinate mc(rec.x, rec.y);
282  m_instanceTree->findInstances(mc, rec.w, rec.h, matching_instances);
283 
284  return matching_instances;
285  }
286 
287  void Layer::getMinMaxCoordinates(ModelCoordinate& min, ModelCoordinate& max, const Layer* layer) const {
288  if (!layer) {
289  layer = this;
290  }
291 
292  if (m_instances.empty()) {
293  min = ModelCoordinate();
294  max = min;
295  } else {
296  min = m_instances.front()->getLocationRef().getLayerCoordinates(layer);
297  max = min;
298 
299  for (std::vector<Instance*>::const_iterator i = m_instances.begin(); i != m_instances.end(); ++i) {
300  ModelCoordinate coord = (*i)->getLocationRef().getLayerCoordinates(layer);
301  min.x = std::min(min.x, coord.x);
302  max.x = std::max(max.x, coord.x);
303  min.y = std::min(min.y, coord.y);
304  max.y = std::max(max.y, coord.y);
305  }
306  }
307 
308  }
309 
310  void Layer::setInstancesVisible(bool vis) {
311  if (m_instancesVisibility != vis) {
312  m_instancesVisibility = vis;
313  std::vector<Instance*>::iterator it = m_instances.begin();
314  for (; it != m_instances.end(); ++it) {
315  (*it)->callOnVisibleChange();
316  }
317  }
318  }
319 
321  if (m_transparency != transparency) {
322  m_transparency = transparency;
323  std::vector<Instance*>::iterator it = m_instances.begin();
324  for (; it != m_instances.end(); ++it) {
325  (*it)->callOnTransparencyChange();
326  }
327  }
328  }
329 
331  return m_transparency;
332  }
333 
336  }
337 
339  return m_instancesVisibility;
340  }
341 
343  bool blockingInstance = false;
344  if (m_cellCache) {
345  Cell* cell = m_cellCache->getCell(cellCoordinate);
346  if (cell) {
347  return cell->getCellType() != CTYPE_NO_BLOCKER;
348  }
349  } else {
350  std::list<Instance*> adjacentInstances;
351  m_instanceTree->findInstances(cellCoordinate, 0, 0, adjacentInstances);
352  for(std::list<Instance*>::const_iterator j = adjacentInstances.begin(); j != adjacentInstances.end(); ++j) {
353  if((*j)->isBlocking() && (*j)->getLocationRef().getLayerCoordinates() == cellCoordinate) {
354  blockingInstance = true;
355  break;
356  }
357  }
358  }
359  return blockingInstance;
360  }
361 
362  std::vector<Instance*> Layer::getBlockingInstances(const ModelCoordinate& cellCoordinate) {
363  std::vector<Instance*> blockingInstances;
364  if (m_cellCache) {
365  Cell* cell = m_cellCache->getCell(cellCoordinate);
366  if (cell) {
367  const std::set<Instance*>& blocker = cell->getInstances();
368  for (std::set<Instance*>::const_iterator it = blocker.begin(); it != blocker.end(); ++it) {
369  if ((*it)->isBlocking()) {
370  blockingInstances.push_back(*it);
371  }
372  }
373  }
374  } else {
375  std::list<Instance*> adjacentInstances;
376  m_instanceTree->findInstances(cellCoordinate, 0, 0, adjacentInstances);
377  for(std::list<Instance*>::const_iterator j = adjacentInstances.begin(); j != adjacentInstances.end(); ++j) {
378  if((*j)->isBlocking() && (*j)->getLocationRef().getLayerCoordinates() == cellCoordinate) {
379  blockingInstances.push_back(*j);
380  }
381  }
382  }
383  return blockingInstances;
384  }
385 
387  m_pathingStrategy = strategy;
389  }
390 
392  return m_pathingStrategy;
393  }
394 
396  m_sortingStrategy = strategy;
397  }
398 
400  return m_sortingStrategy;
401  }
402 
403  void Layer::setWalkable(bool walkable) {
404  m_walkable = walkable;
405  }
406 
408  return m_walkable;
409  }
410 
411  void Layer::setInteract(bool interact, const std::string& id) {
412  m_interact = interact;
413  m_walkableId = id;
414  }
415 
417  return m_interact;
418  }
419 
420  const std::string& Layer::getWalkableId() {
421  return m_walkableId;
422  }
423 
425  if (m_walkable) {
426  m_interacts.push_back(layer);
427  }
428  }
429 
430  const std::vector<Layer*>& Layer::getInteractLayers() {
431  return m_interacts;
432  }
433 
435  if (m_walkable) {
436  std::vector<Layer*>::iterator it = m_interacts.begin();
437  for (; it != m_interacts.end(); ++it) {
438  if (*it == layer) {
439  (*it)->removeChangeListener(m_cellCache->getCellCacheChangeListener());
440  m_interacts.erase(it);
441  break;
442  }
443  }
444  }
445  }
446 
448  if (!m_cellCache && m_walkable) {
449  m_cellCache = new CellCache(this);
450  }
451  }
452 
454  return m_cellCache;
455  }
456 
458  if (m_walkable) {
460  if (!m_interacts.empty()) {
461  std::vector<Layer*>::iterator it = m_interacts.begin();
462  for (; it != m_interacts.end(); ++it) {
463  (*it)->removeChangeListener(m_cellCache->getCellCacheChangeListener());
464  (*it)->setInteract(false, "");
465  }
466  m_interacts.clear();
467  }
468  delete m_cellCache;
469  m_cellCache = NULL;
470  m_walkable = false;
471  }
472  }
473 
474  bool Layer::update() {
475  m_changedInstances.clear();
476  std::vector<Instance*> inactiveInstances;
477  std::set<Instance*>::iterator it = m_activeInstances.begin();
478  for(; it != m_activeInstances.end(); ++it) {
479  if ((*it)->update() != ICHANGE_NO_CHANGES) {
480  m_changedInstances.push_back(*it);
481  m_changed = true;
482  } else if (!(*it)->isActive()) {
483  inactiveInstances.push_back(*it);
484  }
485  }
486  if (!m_changedInstances.empty()) {
487  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
488  while (i != m_changeListeners.end()) {
489  (*i)->onLayerChanged(this, m_changedInstances);
490  ++i;
491  }
492  //std::cout << "Layer named " << Id() << " changed = 1\n";
493  }
494  // remove inactive instances from m_activeInstances
495  if (!inactiveInstances.empty()) {
496  std::vector<Instance*>::iterator i = inactiveInstances.begin();
497  while (i != inactiveInstances.end()) {
498  m_activeInstances.erase(*i);
499  ++i;
500  }
501  }
502  //std::cout << "Layer named " << Id() << " changed = 0\n";
503  bool retval = m_changed;
504  m_changed = false;
505  return retval;
506  }
507 
509  m_changeListeners.push_back(listener);
510  }
511 
513  std::vector<LayerChangeListener*>::iterator i = m_changeListeners.begin();
514  while (i != m_changeListeners.end()) {
515  if ((*i) == listener) {
516  m_changeListeners.erase(i);
517  return;
518  }
519  ++i;
520  }
521  }
522 
524  return m_changed;
525  }
526 
527  std::vector<Instance*>& Layer::getChangedInstances() {
528  return m_changedInstances;
529  }
530 
531  void Layer::setStatic(bool stati) {
532  m_static = stati;
533  }
534 
536  return m_static;
537  }
538 } // FIFE
void setInstancesVisible(bool vis)
Set object visibility.
Definition: layer.cpp:310
SortingStrategy m_sortingStrategy
sorting strategy for rendering
Definition: layer.h:366
std::vector< LayerChangeListener * > m_changeListeners
listeners for layer changes
Definition: layer.h:378
Map * getMap() const
Get the map this layer is contained in.
Definition: layer.cpp:88
bool isChanged()
Returns true, if layer information was changed during previous update round.
Definition: layer.cpp:523
bool m_walkable
is walkable true/false
Definition: layer.h:368
bool m_static
true if layer is static
Definition: layer.h:384
void setExactLayerCoordinates(const ExactModelCoordinate &coordinates)
Sets precise layer coordinates to this location.
Definition: location.cpp:87
Layer * getLayer(const std::string &identifier)
Get the layer with the given id.
Definition: map.cpp:69
std::vector< Instance * > getInstancesAt(Location &loc, bool use_exactcoordinates=false)
Returns instances that match given location.
Definition: layer.cpp:260
T h
Height of the rectangle.
Definition: rect.h:93
InstanceTree * m_instanceTree
The instance tree.
Definition: layer.h:360
Object class.
Definition: object.h:51
bool isActive() const
If this returns true, the instance needs to be updated.
Definition: instance.cpp:276
void setLayer(Layer *layer)
Sets layer where this location is pointing to.
Definition: location.cpp:79
~Layer()
Destructs a Layer instance.
Definition: layer.cpp:66
std::vector< Instance * > & getChangedInstances()
Returns instances that were changed during previous update round.
Definition: layer.cpp:527
T x
The X Coordinate.
Definition: rect.h:84
void setId(const std::string &id)
Sets the identifier for this layer.
Definition: layer.cpp:84
A CellCache is an abstract depiction of one or a few layers and contains additional information...
Definition: cellcache.h:111
void toggleInstancesVisible()
Toggle object visibility.
Definition: layer.cpp:334
void setSortingStrategy(SortingStrategy strategy)
Sets sorting strategy for the layer.
Definition: layer.cpp:395
bool hasInstances() const
Check existance of objects on this layer.
Definition: layer.cpp:104
void destroyCellCache()
Destroys the CellCache of this layer.
Definition: layer.cpp:457
std::list< Instance * > getInstancesIn(Rect &rec)
Returns instances that match given rect.
Definition: layer.cpp:279
CellCache * getCellCache()
Returns the CellCache of this layer.
Definition: layer.cpp:453
void createCellCache()
Called from Map to create a CellCache.
Definition: layer.cpp:447
Instance * createInstance(Object *object, const ModelCoordinate &p, const std::string &id="")
Add an instance of an object at a specific position.
Definition: layer.cpp:108
static Logger _log(LM_AUDIO)
CellGrid * m_grid
layer&#39;s cellgrid
Definition: layer.h:362
bool m_instancesVisibility
if true the instances are visibility otherwise they are skipped during rendering
Definition: layer.h:352
Layer(const std::string &identifier, Map *map, CellGrid *grid)
Constructor Layers are created by calling addLayer from map, thus this method should really be called...
Definition: layer.cpp:47
bool areInstancesVisible() const
Check object visibility.
Definition: layer.cpp:338
InstanceTree * getInstanceTree(void) const
Get the instance tree.
Definition: layer.cpp:100
CellCache * m_cellCache
pointer to cellcache
Definition: layer.h:376
Location & getLocationRef()
Gets reference of current location of instance.
Definition: instance.cpp:307
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
Definition: location.cpp:113
void setCellGrid(CellGrid *grid)
Set the Cellgrid.
Definition: layer.cpp:96
std::set< Instance * > m_activeInstances
all the active instances on this layer
Definition: layer.h:358
bool update()
Called periodically to update events on layer.
Definition: layer.cpp:474
void addInteractLayer(Layer *layer)
Adds a interact layer to the walkable layer.
Definition: layer.cpp:424
std::vector< Instance * > getBlockingInstances(const ModelCoordinate &cellCoordinate)
Returns instances that blocks on given cell.
Definition: layer.cpp:362
uint8_t m_transparency
transparency, value 0 means total visible, 128 semi-transparent and 255 invisibility ...
Definition: layer.h:354
void removeInstance(Instance *instance)
Remove an instance from the layer.
Definition: layer.cpp:158
#define FL_ERR(logger, msg)
Definition: logger.h:73
void setPathingStrategy(PathingStrategy strategy)
Sets pathing strategy for the layer.
Definition: layer.cpp:386
void getMinMaxCoordinates(ModelCoordinate &min, ModelCoordinate &max, const Layer *layer=0) const
Retrieves the minimum/maximum coordinates of instances on the layer.
Definition: layer.cpp:287
void purge(Seq &c)
Definition: purge.h:28
void findInstances(const ModelCoordinate &point, int32_t w, int32_t h, InstanceList &list)
Find all instances in a given area.
unsigned char uint8_t
Definition: core.h:38
void setStatic(bool stati)
Marks this layer as visual static.
Definition: layer.cpp:531
void removeChangeListener(LayerChangeListener *listener)
Removes associated change listener.
Definition: layer.cpp:512
bool addInstance(Instance *instance, const ExactModelCoordinate &p)
Add a valid instance at a specific position.
Definition: layer.cpp:133
const std::string & getWalkableId()
Returns the id of the walkable layer if this is a interact layer otherwise the string is empty...
Definition: layer.cpp:420
Cell * getCell(const ModelCoordinate &mc)
Returns cell on this coordinate.
Definition: cellcache.cpp:706
Point3D ModelCoordinate
Definition: modelcoords.h:37
const std::set< Instance * > & getInstances()
Returns all instances on this cell.
Definition: cell.cpp:484
CellTypeInfo getCellType()
Returns blocker type.
Definition: cell.cpp:476
bool m_changed
true if layer (or it&#39;s instance) information was changed during previous update round ...
Definition: layer.h:382
Instance * getInstance(const std::string &identifier)
Get the first instance on this layer with the given identifier.
Definition: layer.cpp:240
A basic layer on a map.
Definition: layer.h:98
bool isWalkable()
Returns if a layer is walkable.
Definition: layer.cpp:407
Listener interface for changes happening on a layer.
Definition: layer.h:70
void removeInstance(Instance *instance)
Removes an instance from the quad tree.
SortingStrategy
Definition: layer.h:62
void addChangeListener(LayerChangeListener *listener)
Adds new change listener.
Definition: layer.cpp:508
bool isStatic()
Returns true, if layer is static.
Definition: layer.cpp:535
void setLayerTransparency(uint8_t transparency)
Sets the transparency of all instances on the layer.
Definition: layer.cpp:320
ExactModelCoordinate & getExactLayerCoordinatesRef()
Gets reference to exact layer coordinates.
Definition: location.cpp:105
A basic cell on a CellCache.
Definition: cell.h:136
void setAllowDiagonals(const bool allow_diagonals)
Set whether diagonal cell access is allowed.
Definition: cellgrid.h:221
T y
The Y Coordinate.
Definition: rect.h:87
CellGrid * getCellGrid() const
Get the Cellgrid.
Definition: layer.cpp:92
void addInstance(Instance *instance)
Adds an instance to the quad tree.
PathingStrategy getPathingStrategy() const
Gets pathing strategy for the layer.
Definition: layer.cpp:391
void setInteract(bool interact, const std::string &id)
Sets interact for the layer.
Definition: layer.cpp:411
const std::vector< Layer * > & getInteractLayers()
Returns all assigned interact layer.
Definition: layer.cpp:430
void setWalkable(bool walkable)
Sets walkable for the layer.
Definition: layer.cpp:403
std::string m_id
string identifier
Definition: layer.h:348
bool m_interact
is interact true/false
Definition: layer.h:370
A 3D Point.
Definition: point.h:202
PathingStrategy
Defines how pathing can be performed on this layer.
Definition: layer.h:57
const std::string & getId() const
Get the id of this layer.
Definition: layer.cpp:80
SortingStrategy getSortingStrategy() const
Gets sorting strategy for the layer.
Definition: layer.cpp:399
std::vector< Instance * > m_instances
all the instances on this layer
Definition: layer.h:356
LayerChangeListener * getCellCacheChangeListener()
Returns change listener.
Definition: cellcache.cpp:798
InstanceChangeInfo update()
Updates the instance related to the current action.
Definition: instance.cpp:721
const std::vector< Instance * > & getInstances() const
Get the list of instances on this layer.
Definition: layer.cpp:228
bool cellContainsBlockingInstance(const ModelCoordinate &cellCoordinate)
Determines if a given cell on the layer contains a blocking instance.
Definition: layer.cpp:342
void removeInteractLayer(Layer *layer)
Removes a interact layer from the walkable layer.
Definition: layer.cpp:434
std::vector< Layer * > m_interacts
all assigned interact layers
Definition: layer.h:374
void setInstanceActivityStatus(Instance *instance, bool active)
Sets the activity status for given instance on this layer.
Definition: layer.cpp:232
A container of Layer(s).
Definition: map.h:87
void deleteInstance(Instance *instance)
Remove an instance from the layer and delete it.
Definition: layer.cpp:192
PathingStrategy m_pathingStrategy
pathing strategy for the layer
Definition: layer.h:364
bool isInteract()
Returns if a layer is interact.
Definition: layer.cpp:416
uint8_t getLayerTransparency()
Returns the layer&#39;s transparency value.
Definition: layer.cpp:330
Map * m_map
pointer to map
Definition: layer.h:350
T w
Width of the rectangle.
Definition: rect.h:90
An Instance is an &quot;instantiation&quot; of an Object at a Location.
Definition: instance.h:97
std::string m_walkableId
walkable id
Definition: layer.h:372
std::vector< Instance * > m_changedInstances
holds changed instances after each update
Definition: layer.h:380