22 #ifndef FIFE_CELLCACHE_H 23 #define FIFE_CELLCACHE_H 79 const std::set<Cell*>&
getCells()
const;
135 void resize(
const Rect& rec);
165 const std::vector<std::vector<Cell*> >&
getCells();
177 void addInteractOnRuntime(
Layer* interact);
182 void removeInteractOnRuntime(
Layer* interact);
197 const Rect& getSize();
203 void setSize(
const Rect& rec);
219 bool isInCellCache(
const Location& location)
const;
236 int32_t getMaxIndex()
const;
241 void setMaxNeighborZ(int32_t z);
246 int32_t getMaxNeighborZ();
260 std::vector<Cell*> getCellsInRect(
const Rect& rec);
266 std::vector<Cell*> getBlockingCellsInRect(
const Rect& rec);
282 std::vector<Cell*> getCellsInCircleSegment(
const ModelCoordinate& center,
uint16_t radius, int32_t sangle, int32_t eangle);
288 void registerCost(
const std::string& costId,
double cost);
293 void unregisterCost(
const std::string& costId);
299 double getCost(
const std::string& costId);
304 bool existsCost(
const std::string& costId);
309 std::list<std::string> getCosts();
313 void unregisterAllCosts();
319 void addCellToCost(
const std::string& costId,
Cell* cell);
325 void addCellsToCost(
const std::string& costId,
const std::vector<Cell*>& cells);
330 void removeCellFromCost(
Cell* cell);
336 void removeCellFromCost(
const std::string& costId,
Cell* cell);
342 void removeCellsFromCost(
const std::string& costId,
const std::vector<Cell*>& cells);
348 std::vector<Cell*> getCostCells(
const std::string& costId);
354 std::vector<std::string> getCellCosts(
Cell* cell);
361 bool existsCostForCell(
const std::string& costId,
Cell* cell);
383 bool getCellSpeedMultiplier(
const ModelCoordinate& cell,
double& multiplier);
388 void setDefaultCostMultiplier(
double multi);
393 double getDefaultCostMultiplier();
398 void setDefaultSpeedMultiplier(
double multi);
403 double getDefaultSpeedMultiplier();
409 bool isDefaultCost(
Cell* cell);
415 void setCostMultiplier(
Cell* cell,
double multi);
421 double getCostMultiplier(
Cell* cell);
426 void resetCostMultiplier(
Cell* cell);
432 bool isDefaultSpeed(
Cell* cell);
438 void setSpeedMultiplier(
Cell* cell,
double multi);
444 double getSpeedMultiplier(
Cell* cell);
449 void resetSpeedMultiplier(
Cell* cell);
454 void addTransition(
Cell* cell);
459 void removeTransition(
Cell* cell);
470 const std::vector<Zone*>& getZones();
486 void removeZone(
Zone* zone);
491 void splitZone(
Cell* cell);
497 void mergeZones(
Zone* zone1,
Zone* zone2);
503 void addNarrowCell(
Cell* cell);
508 const std::set<Cell*>& getNarrowCells();
513 void removeNarrowCell(
Cell* cell);
517 void resetNarrowCells();
523 bool isSearchNarrowCells();
528 void setSearchNarrowCells(
bool search);
535 void addCellToArea(
const std::string&
id,
Cell* cell);
542 void addCellsToArea(
const std::string&
id,
const std::vector<Cell*>& cells);
547 void removeCellFromArea(
Cell* cell);
553 void removeCellFromArea(
const std::string&
id,
Cell* cell);
559 void removeCellsFromArea(
const std::string&
id,
const std::vector<Cell*>& cells);
564 void removeArea(
const std::string&
id);
570 bool existsArea(
const std::string&
id);
575 std::vector<std::string> getAreas();
581 std::vector<std::string> getCellAreas(
Cell* cell);
587 std::vector<Cell*> getAreaCells(
const std::string&
id);
594 bool isCellInArea(
const std::string&
id,
Cell* cell);
599 void setStaticSize(
bool staticSize);
606 void setBlockingUpdate(
bool update);
607 void setSizeUpdate(
bool update);
617 Rect calculateCurrentSize();
StringCellMultimap::iterator StringCellIterator
uint32_t m_width
cache width
Layer * m_layer
walkable layer
void addCell(Cell *cell)
Adds a cell to this zone.
uint32_t next(octet_iterator &it, octet_iterator end)
std::set< Cell * > m_cells
cells in the zone
Listener interface for changes happening on a cell.
std::set< Cell * > m_narrowCells
special cells which are monitored (zone split and merge)
StringCellMultimap m_costsToCells
holds cells for each cost
StringCellMultimap m_cellAreas
areas with assigned cells
A CellCache is an abstract depiction of one or a few layers and contains additional information...
bool m_blockingUpdate
indicates blocking update
std::vector< std::vector< Cell * > > m_cells
Base class for all fife classes Used e.g.
double m_defaultCostMulti
default cost
void removeCell(Cell *cell)
Removes a cell from this zone.
std::vector< Zone * > m_zones
zones
int32_t m_neighborZ
max z value for neighbors
std::map< Cell *, double > m_speedMultipliers
holds default speed multiplier, only if it is not default(1.0)
void resetCells()
Remove all cells from zone but does not alter the cells.
std::map< std::string, double > m_costsTable
holds cost table
Listener interface for changes happening on a layer.
bool m_searchNarrow
is automatic seach enabled
CellChangeListener * m_cellZoneListener
listener for zones
double m_defaultSpeedMulti
default speed
A basic cell on a CellCache.
LayerChangeListener * m_cellListener
change listener
Rect m_size
Rect holds the min and max size x = min.x, w = max.x, y = min.y, h = max.y.
const std::set< Cell * > & getCells() const
Returns all cells of this zone.
std::map< Cell *, double > m_costMultipliers
holds default cost multiplier, only if it is not default(1.0)
uint32_t m_height
cache height
std::multimap< std::string, Cell * > StringCellMultimap
void mergeZone(Zone *zone)
Merge two zones to one.
std::pair< StringCellIterator, StringCellIterator > StringCellPair
bool m_staticSize
is automatic size update enabled/disabled
Zone(uint32_t id)
Constructor.
uint32_t getCellCount() const
Returns the number of cells.
bool m_sizeUpdate
indicates size update
std::vector< Cell * > getTransitionCells(Layer *layer=NULL)
Returns transistion cells of this zone.
std::vector< Cell * > m_transitions
cells with transitions
uint32_t getId() const
Returns the zone identifier.
A Zone is an abstract depiction of a CellCache or of a part of it.