FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
A basic layer on a map. More...
#include <layer.h>
Public Member Functions | |
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 only by map or test code. More... | |
~Layer () | |
Destructs a Layer instance. More... | |
const std::string & | getId () const |
Get the id of this layer. More... | |
void | setId (const std::string &id) |
Sets the identifier for this layer. More... | |
Map * | getMap () const |
Get the map this layer is contained in. More... | |
CellGrid * | getCellGrid () const |
Get the Cellgrid. More... | |
void | setCellGrid (CellGrid *grid) |
Set the Cellgrid. More... | |
InstanceTree * | getInstanceTree (void) const |
Get the instance tree. More... | |
bool | hasInstances () const |
Check existance of objects on this layer. More... | |
Instance * | createInstance (Object *object, const ModelCoordinate &p, const std::string &id="") |
Add an instance of an object at a specific position. More... | |
Instance * | createInstance (Object *object, const ExactModelCoordinate &p, const std::string &id="") |
Add an instance of an object at a specific position. More... | |
bool | addInstance (Instance *instance, const ExactModelCoordinate &p) |
Add a valid instance at a specific position. More... | |
void | removeInstance (Instance *instance) |
Remove an instance from the layer. More... | |
void | deleteInstance (Instance *instance) |
Remove an instance from the layer and delete it. More... | |
const std::vector< Instance * > & | getInstances () const |
Get the list of instances on this layer. More... | |
std::vector< Instance * > | getInstances (const std::string &id) |
Get the list of instances on this layer with the given identifier. More... | |
std::vector< Instance * > | getInstancesAt (Location &loc, bool use_exactcoordinates=false) |
Returns instances that match given location. More... | |
std::list< Instance * > | getInstancesIn (Rect &rec) |
Returns instances that match given rect. More... | |
std::vector< Instance * > | getInstancesInLine (const ModelCoordinate &pt1, const ModelCoordinate &pt2) |
Returns instances that match given line between pt1 and pt2. More... | |
std::vector< Instance * > | getInstancesInCircle (const ModelCoordinate ¢er, uint16_t radius) |
Returns instances that match given center and radius of the circle. More... | |
std::vector< Instance * > | getInstancesInCircleSegment (const ModelCoordinate ¢er, uint16_t radius, int32_t sangle, int32_t eangle) |
Returns all instances in the circle segment. More... | |
Instance * | getInstance (const std::string &identifier) |
Get the first instance on this layer with the given identifier. More... | |
void | setInstancesVisible (bool vis) |
Set object visibility. More... | |
void | setLayerTransparency (uint8_t transparency) |
Sets the transparency of all instances on the layer. More... | |
uint8_t | getLayerTransparency () |
Returns the layer's transparency value. More... | |
void | getMinMaxCoordinates (ModelCoordinate &min, ModelCoordinate &max, const Layer *layer=0) const |
Retrieves the minimum/maximum coordinates of instances on the layer. More... | |
float | getZOffset () const |
Calculates z offset for the layer. More... | |
uint32_t | getLayerCount () const |
Get the overall number of layers. More... | |
bool | cellContainsBlockingInstance (const ModelCoordinate &cellCoordinate) |
Determines if a given cell on the layer contains a blocking instance. More... | |
std::vector< Instance * > | getBlockingInstances (const ModelCoordinate &cellCoordinate) |
Returns instances that blocks on given cell. More... | |
void | toggleInstancesVisible () |
Toggle object visibility. More... | |
bool | areInstancesVisible () const |
Check object visibility. More... | |
bool | update () |
Called periodically to update events on layer. More... | |
void | setPathingStrategy (PathingStrategy strategy) |
Sets pathing strategy for the layer. More... | |
PathingStrategy | getPathingStrategy () const |
Gets pathing strategy for the layer. More... | |
void | setSortingStrategy (SortingStrategy strategy) |
Sets sorting strategy for the layer. More... | |
SortingStrategy | getSortingStrategy () const |
Gets sorting strategy for the layer. More... | |
void | setWalkable (bool walkable) |
Sets walkable for the layer. More... | |
bool | isWalkable () |
Returns if a layer is walkable. More... | |
void | setInteract (bool interact, const std::string &id) |
Sets interact for the layer. More... | |
bool | isInteract () |
Returns if a layer is interact. More... | |
const std::string & | getWalkableId () |
Returns the id of the walkable layer if this is a interact layer otherwise the string is empty. More... | |
void | addInteractLayer (Layer *layer) |
Adds a interact layer to the walkable layer. More... | |
const std::vector< Layer * > & | getInteractLayers () |
Returns all assigned interact layer. More... | |
void | removeInteractLayer (Layer *layer) |
Removes a interact layer from the walkable layer. More... | |
void | createCellCache () |
Called from Map to create a CellCache. More... | |
CellCache * | getCellCache () |
Returns the CellCache of this layer. More... | |
void | destroyCellCache () |
Destroys the CellCache of this layer. More... | |
void | addChangeListener (LayerChangeListener *listener) |
Adds new change listener. More... | |
void | removeChangeListener (LayerChangeListener *listener) |
Removes associated change listener. More... | |
bool | isChanged () |
Returns true, if layer information was changed during previous update round. More... | |
std::vector< Instance * > & | getChangedInstances () |
Returns instances that were changed during previous update round. More... | |
void | setInstanceActivityStatus (Instance *instance, bool active) |
Sets the activity status for given instance on this layer. More... | |
void | setStatic (bool stati) |
Marks this layer as visual static. More... | |
bool | isStatic () |
Returns true, if layer is static. More... | |
Public Member Functions inherited from FIFE::FifeClass | |
FifeClass () | |
virtual | ~FifeClass () |
fifeid_t | getFifeId () |
Gets unique id of this instance inside the engine. More... | |
Protected Attributes | |
std::string | m_id |
string identifier More... | |
Map * | m_map |
pointer to map More... | |
bool | m_instancesVisibility |
if true the instances are visibility otherwise they are skipped during rendering More... | |
uint8_t | m_transparency |
transparency, value 0 means total visible, 128 semi-transparent and 255 invisibility More... | |
std::vector< Instance * > | m_instances |
all the instances on this layer More... | |
std::set< Instance * > | m_activeInstances |
all the active instances on this layer More... | |
InstanceTree * | m_instanceTree |
The instance tree. More... | |
CellGrid * | m_grid |
layer's cellgrid More... | |
PathingStrategy | m_pathingStrategy |
pathing strategy for the layer More... | |
SortingStrategy | m_sortingStrategy |
sorting strategy for rendering More... | |
bool | m_walkable |
is walkable true/false More... | |
bool | m_interact |
is interact true/false More... | |
std::string | m_walkableId |
walkable id More... | |
std::vector< Layer * > | m_interacts |
all assigned interact layers More... | |
CellCache * | m_cellCache |
pointer to cellcache More... | |
std::vector< LayerChangeListener * > | m_changeListeners |
listeners for layer changes More... | |
std::vector< Instance * > | m_changedInstances |
holds changed instances after each update More... | |
bool | m_changed |
true if layer (or it's instance) information was changed during previous update round More... | |
bool | m_static |
true if layer is static More... | |
FIFE::Layer::~Layer | ( | ) |
Destructs a Layer instance.
Definition at line 67 of file layer.cpp.
References destroyCellCache(), FIFE::Map::getLayer(), m_instances, m_instanceTree, m_interact, m_map, m_walkableId, purge(), and removeInteractLayer().
void FIFE::Layer::addChangeListener | ( | LayerChangeListener * | listener | ) |
Adds new change listener.
listener | to add |
Definition at line 628 of file layer.cpp.
References m_changeListeners.
Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::CellCache::CellCache(), and FIFE::LayerCache::setLayer().
bool FIFE::Layer::addInstance | ( | Instance * | instance, |
const ExactModelCoordinate & | p | ||
) |
Add a valid instance at a specific position.
This is temporary. It will be moved to a higher level later so that we can ensure that each Instance only lives in one layer.
Definition at line 134 of file layer.cpp.
References FIFE::_log, FIFE::InstanceTree::addInstance(), FL_ERR, FIFE::Instance::getLocationRef(), FIFE::Instance::isActive(), m_changed, m_changeListeners, m_instances, m_instanceTree, FIFE::Location::setExactLayerCoordinates(), setInstanceActivityStatus(), and FIFE::Location::setLayer().
Referenced by FIFE::Map::update().
void FIFE::Layer::addInteractLayer | ( | Layer * | layer | ) |
Adds a interact layer to the walkable layer.
layer | A pointer to the interact layer that should be added. |
Definition at line 544 of file layer.cpp.
References m_interacts, and m_walkable.
Referenced by FIFE::CellCache::addInteractOnRuntime(), and FIFE::Map::initializeCellCaches().
bool FIFE::Layer::areInstancesVisible | ( | ) | const |
Check object visibility.
Definition at line 458 of file layer.cpp.
References m_instancesVisibility.
Referenced by FIFE::LightRenderer::render().
bool FIFE::Layer::cellContainsBlockingInstance | ( | const ModelCoordinate & | cellCoordinate | ) |
Determines if a given cell on the layer contains a blocking instance.
cellCoordinate | A const reference to a model coordinate of the cell in question. |
Definition at line 462 of file layer.cpp.
References FIFE::CTYPE_NO_BLOCKER, FIFE::InstanceTree::findInstances(), FIFE::CellCache::getCell(), FIFE::Cell::getCellType(), m_cellCache, and m_instanceTree.
Referenced by FIFE::RoutePather::followRoute(), and FIFE::Route::getBlockingPathLocations().
void FIFE::Layer::createCellCache | ( | ) |
Called from Map to create a CellCache.
Only walkable layers can create one CellCache.
Definition at line 567 of file layer.cpp.
References m_cellCache, and m_walkable.
Instance * FIFE::Layer::createInstance | ( | Object * | object, |
const ModelCoordinate & | p, | ||
const std::string & | id = "" |
||
) |
Add an instance of an object at a specific position.
Definition at line 109 of file layer.cpp.
References FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by FIFE::Instance::Instance(), and FIFE::MapLoader::load().
Instance * FIFE::Layer::createInstance | ( | Object * | object, |
const ExactModelCoordinate & | p, | ||
const std::string & | id = "" |
||
) |
Add an instance of an object at a specific position.
Definition at line 114 of file layer.cpp.
References FIFE::InstanceTree::addInstance(), FIFE::Instance::isActive(), m_changed, m_changeListeners, m_instances, m_instanceTree, FIFE::Location::setExactLayerCoordinates(), and setInstanceActivityStatus().
void FIFE::Layer::deleteInstance | ( | Instance * | instance | ) |
Remove an instance from the layer and delete it.
Definition at line 193 of file layer.cpp.
References FIFE::ICHANGE_NO_CHANGES, FIFE::Instance::isActive(), m_changed, m_changeListeners, m_instances, m_instanceTree, FIFE::InstanceTree::removeInstance(), setInstanceActivityStatus(), and FIFE::Instance::update().
void FIFE::Layer::destroyCellCache | ( | ) |
Destroys the CellCache of this layer.
Definition at line 577 of file layer.cpp.
References FIFE::CellCache::getCellCacheChangeListener(), m_cellCache, m_interacts, m_walkable, and removeChangeListener().
Referenced by ~Layer().
std::vector< Instance * > FIFE::Layer::getBlockingInstances | ( | const ModelCoordinate & | cellCoordinate | ) |
Returns instances that blocks on given cell.
cellCoordinate | A const reference to a model coordinate of the cell in question. |
Definition at line 482 of file layer.cpp.
References FIFE::InstanceTree::findInstances(), FIFE::CellCache::getCell(), FIFE::Cell::getInstances(), m_cellCache, and m_instanceTree.
CellCache * FIFE::Layer::getCellCache | ( | ) |
Returns the CellCache of this layer.
In case there is no it returns NULL.
Definition at line 573 of file layer.cpp.
References m_cellCache.
Referenced by FIFE::Cell::addInstance(), FIFE::Cell::addInstances(), FIFE::Trigger::assign(), FIFE::Cell::createTransition(), FIFE::TriggerController::createTriggerOnLocation(), FIFE::TriggerController::createTriggerOnRect(), FIFE::Cell::defaultCost(), FIFE::Cell::defaultSpeed(), FIFE::Cell::deleteTransition(), FIFE::RoutePather::followRoute(), FIFE::Cell::getCostMultiplier(), FIFE::Cell::getSpeedMultiplier(), FIFE::MapLoader::load(), FIFE::Trigger::moveTo(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), FIFE::CellCacheChangeListener::onLayerChanged(), FIFE::Trigger::remove(), FIFE::Cell::removeInstance(), FIFE::TriggerController::removeTriggerFromRect(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::Cell::resetCostMultiplier(), FIFE::Cell::resetNeighbors(), FIFE::Cell::resetSpeedMultiplier(), FIFE::RoutePatherSearch::RoutePatherSearch(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor(), FIFE::Cell::setCostMultiplier(), FIFE::Cell::setSpeedMultiplier(), FIFE::RoutePather::solveRoute(), FIFE::Cell::updateCellBlockingInfo(), FIFE::MultiLayerSearch::updateSearch(), and FIFE::Cell::~Cell().
CellGrid * FIFE::Layer::getCellGrid | ( | ) | const |
Get the Cellgrid.
Definition at line 93 of file layer.cpp.
References m_grid.
Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::CellCache::createCells(), FIFE::Instance::follow(), FIFE::RoutePather::followRoute(), FIFE::CellCache::getAdjacentCost(), FIFE::getAngleBetween(), FIFE::CellCache::getCellsInLine(), FIFE::Location::getExactLayerCoordinates(), FIFE::getFacing(), FIFE::Location::getLayerCoordinates(), FIFE::Camera::getLogicalCellDimensions(), FIFE::Location::getMapCoordinates(), FIFE::Camera::getOriginalZToY(), FIFE::Location::isValid(), FIFE::Instance::move(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), FIFE::CellCacheChangeListener::onLayerChanged(), FIFE::ModelMapObserver::onLayerDelete(), FIFE::Instance::processMovement(), FIFE::CellCache::removeInteractOnRuntime(), FIFE::GridRenderer::render(), FIFE::InstanceRenderer::render(), FIFE::QuadTreeRenderer::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::CellRenderer::render(), FIFE::CellCache::resize(), FIFE::Camera::setLocation(), FIFE::Location::setMapCoordinates(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().
std::vector< Instance * > & FIFE::Layer::getChangedInstances | ( | ) |
Returns instances that were changed during previous update round.
Definition at line 647 of file layer.cpp.
References m_changedInstances.
const std::string & FIFE::Layer::getId | ( | ) | const |
Get the id of this layer.
Definition at line 81 of file layer.cpp.
References m_id.
Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::Camera::renderStaticLayer(), and FIFE::MapSaver::save().
Instance * FIFE::Layer::getInstance | ( | const std::string & | identifier | ) |
Get the first instance on this layer with the given identifier.
Definition at line 241 of file layer.cpp.
References m_instances.
Referenced by FIFE::MapLoader::load().
const std::vector< Instance * > & FIFE::Layer::getInstances | ( | ) | const |
Get the list of instances on this layer.
Definition at line 229 of file layer.cpp.
References m_instances.
std::vector< Instance * > FIFE::Layer::getInstances | ( | const std::string & | id | ) |
Get the list of instances on this layer with the given identifier.
Definition at line 251 of file layer.cpp.
References m_instances.
std::vector< Instance * > FIFE::Layer::getInstancesAt | ( | Location & | loc, |
bool | use_exactcoordinates = false |
||
) |
Returns instances that match given location.
loc | location where to fetch instances from |
use_exactcoordinates | if true, comparison is done using exact coordinates. if not, cell coordinates are used |
Definition at line 261 of file layer.cpp.
References FIFE::Location::getExactLayerCoordinatesRef(), FIFE::Location::getLayerCoordinates(), and m_instances.
Returns instances that match given rect.
rec | rect where to fetch instances from |
Definition at line 280 of file layer.cpp.
References FIFE::InstanceTree::findInstances(), FIFE::RectType< T >::h, m_instanceTree, FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
std::vector< Instance * > FIFE::Layer::getInstancesInCircle | ( | const ModelCoordinate & | center, |
uint16_t | radius | ||
) |
Returns instances that match given center and radius of the circle.
center | A const reference to the ModelCoordinate where the center of the circle is. |
radius | A unsigned integer, radius of the circle. |
Definition at line 301 of file layer.cpp.
References utf8::distance(), FIFE::InstanceTree::findInstances(), m_instanceTree, FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
Referenced by getInstancesInCircleSegment().
std::vector< Instance * > FIFE::Layer::getInstancesInCircleSegment | ( | const ModelCoordinate & | center, |
uint16_t | radius, | ||
int32_t | sangle, | ||
int32_t | eangle | ||
) |
Returns all instances in the circle segment.
center | A const reference to the ModelCoordinate where the center of the circle is. |
radius | A unsigned integer, radius of the circle. |
sangle | A interger, start angle of the segment. |
eangle | A interger, end angle of the segment. |
Definition at line 363 of file layer.cpp.
References FIFE::getAngleBetween(), getInstancesInCircle(), FIFE::intPt2doublePt(), FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
std::vector< Instance * > FIFE::Layer::getInstancesInLine | ( | const ModelCoordinate & | pt1, |
const ModelCoordinate & | pt2 | ||
) |
Returns instances that match given line between pt1 and pt2.
pt1 | A const reference to the ModelCoordinate where to start from. |
pt2 | A const reference to the ModelCoordinate where the end is. |
Definition at line 288 of file layer.cpp.
References FIFE::InstanceTree::findInstances(), FIFE::CellGrid::getCoordinatesInLine(), m_grid, and m_instanceTree.
InstanceTree * FIFE::Layer::getInstanceTree | ( | void | ) | const |
Get the instance tree.
Definition at line 101 of file layer.cpp.
References m_instanceTree.
Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::CellCache::createCells(), FIFE::CellCache::removeInteractOnRuntime(), FIFE::QuadTreeRenderer::render(), FIFE::CellCache::resize(), and FIFE::Instance::setLocation().
const std::vector< Layer * > & FIFE::Layer::getInteractLayers | ( | ) |
Returns all assigned interact layer.
Definition at line 550 of file layer.cpp.
References m_interacts.
Referenced by FIFE::CellCache::calculateCurrentSize(), FIFE::CellCache::CellCache(), FIFE::CellCache::createCells(), FIFE::CellCache::resize(), and FIFE::CellCache::~CellCache().
uint32_t FIFE::Layer::getLayerCount | ( | ) | const |
Get the overall number of layers.
Definition at line 426 of file layer.cpp.
References FIFE::Map::getLayerCount(), and m_map.
uint8_t FIFE::Layer::getLayerTransparency | ( | ) |
Returns the layer's transparency value.
Definition at line 450 of file layer.cpp.
References m_transparency.
Map * FIFE::Layer::getMap | ( | ) | const |
Get the map this layer is contained in.
Definition at line 89 of file layer.cpp.
References m_map.
Referenced by FIFE::Instance::bindTimeProvider(), FIFE::Location::getMap(), FIFE::Instance::getRuntime(), FIFE::Instance::getTotalTimeMultiplier(), FIFE::Instance::processMovement(), and FIFE::MultiLayerSearch::searchBetweenTargetsMap().
void FIFE::Layer::getMinMaxCoordinates | ( | ModelCoordinate & | min, |
ModelCoordinate & | max, | ||
const Layer * | layer = 0 |
||
) | const |
Retrieves the minimum/maximum coordinates of instances on the layer.
min | A reference to a ModelCoordinate that will hold the minimum coordinate. |
max | A reference to a ModelCoordinate that will hold the maximum coordinate. |
layer | A pointer to another layer that can be used to cast coordinates bettween layers. |
Definition at line 385 of file layer.cpp.
References m_instances, FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
Referenced by FIFE::CellCache::calculateCurrentSize(), and FIFE::CellCache::CellCache().
PathingStrategy FIFE::Layer::getPathingStrategy | ( | ) | const |
Gets pathing strategy for the layer.
Definition at line 511 of file layer.cpp.
References m_pathingStrategy.
SortingStrategy FIFE::Layer::getSortingStrategy | ( | ) | const |
Gets sorting strategy for the layer.
Definition at line 519 of file layer.cpp.
References m_sortingStrategy.
const std::string & FIFE::Layer::getWalkableId | ( | ) |
Returns the id of the walkable layer if this is a interact layer otherwise the string is empty.
Definition at line 540 of file layer.cpp.
References m_walkableId.
float FIFE::Layer::getZOffset | ( | ) | const |
Calculates z offset for the layer.
Is in range [-100,100], see glOrtho settings. Used by LayerCache to calculate z values.
Definition at line 408 of file layer.cpp.
References FIFE::Map::getLayerCount(), FIFE::Map::getLayers(), and m_map.
bool FIFE::Layer::hasInstances | ( | ) | const |
Check existance of objects on this layer.
Definition at line 105 of file layer.cpp.
References m_instances.
bool FIFE::Layer::isChanged | ( | ) |
bool FIFE::Layer::isInteract | ( | ) |
Returns if a layer is interact.
Definition at line 536 of file layer.cpp.
References m_interact.
bool FIFE::Layer::isStatic | ( | ) |
bool FIFE::Layer::isWalkable | ( | ) |
Returns if a layer is walkable.
Definition at line 527 of file layer.cpp.
References m_walkable.
void FIFE::Layer::removeChangeListener | ( | LayerChangeListener * | listener | ) |
Removes associated change listener.
listener | to remove |
Definition at line 632 of file layer.cpp.
References m_changeListeners.
Referenced by destroyCellCache(), and FIFE::CellCache::~CellCache().
void FIFE::Layer::removeInstance | ( | Instance * | instance | ) |
Remove an instance from the layer.
Definition at line 159 of file layer.cpp.
References FIFE::ICHANGE_NO_CHANGES, FIFE::Instance::isActive(), m_changed, m_changeListeners, m_instances, m_instanceTree, FIFE::InstanceTree::removeInstance(), setInstanceActivityStatus(), and FIFE::Instance::update().
Referenced by FIFE::Map::update().
void FIFE::Layer::removeInteractLayer | ( | Layer * | layer | ) |
Removes a interact layer from the walkable layer.
layer | A pointer to the interact layer that should be removed. |
Definition at line 554 of file layer.cpp.
References FIFE::CellCache::getCellCacheChangeListener(), m_cellCache, m_interacts, and m_walkable.
Referenced by FIFE::CellCache::removeInteractOnRuntime(), and ~Layer().
void FIFE::Layer::setCellGrid | ( | CellGrid * | grid | ) |
void FIFE::Layer::setId | ( | const std::string & | id | ) |
void FIFE::Layer::setInstanceActivityStatus | ( | Instance * | instance, |
bool | active | ||
) |
Sets the activity status for given instance on this layer.
instance | A pointer to the Instance whose activity is to be changed. |
active | A boolean, true if the instance should be set active otherwise false. |
Definition at line 233 of file layer.cpp.
References m_activeInstances.
Referenced by addInstance(), createInstance(), deleteInstance(), FIFE::Instance::initializeChanges(), and removeInstance().
void FIFE::Layer::setInstancesVisible | ( | bool | vis | ) |
Set object visibility.
Definition at line 430 of file layer.cpp.
References m_instances, and m_instancesVisibility.
Referenced by toggleInstancesVisible().
void FIFE::Layer::setInteract | ( | bool | interact, |
const std::string & | id | ||
) |
Sets interact for the layer.
The data(size, instances) from all interact layers and the walkable layer will merged into one CellCache.
interact | A boolean that mark a layer as interact. |
id | A const reference to a string that should refer to the id of the walkable layer. |
Definition at line 531 of file layer.cpp.
References m_interact, and m_walkableId.
Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::MapLoader::load(), and FIFE::CellCache::removeInteractOnRuntime().
void FIFE::Layer::setLayerTransparency | ( | uint8_t | transparency | ) |
Sets the transparency of all instances on the layer.
0=opaque, 255=transparent
transparency | Transparency value from 0-255. |
Definition at line 440 of file layer.cpp.
References m_instances, and m_transparency.
void FIFE::Layer::setPathingStrategy | ( | PathingStrategy | strategy | ) |
Sets pathing strategy for the layer.
Definition at line 506 of file layer.cpp.
References FIFE::CELL_EDGES_ONLY, m_grid, m_pathingStrategy, and FIFE::CellGrid::setAllowDiagonals().
Referenced by FIFE::MapLoader::load().
void FIFE::Layer::setSortingStrategy | ( | SortingStrategy | strategy | ) |
Sets sorting strategy for the layer.
Definition at line 515 of file layer.cpp.
References m_sortingStrategy.
Referenced by FIFE::MapLoader::load().
void FIFE::Layer::setStatic | ( | bool | stati | ) |
Marks this layer as visual static.
The result is that everything is rendered as one texture. If you have instances with actions/animations on this layer then they are not displayed correctly. Note: Works currently only for OpenGL backend. SDL backend is restricted to the lowest layer.
stati | A boolean, true if the layer should be static. |
Definition at line 651 of file layer.cpp.
References m_static.
void FIFE::Layer::setWalkable | ( | bool | walkable | ) |
Sets walkable for the layer.
Only a walkable layer, can create a CellCache and only on a walkable, instances can move. Also interact layer can only be added to walkables.
walkable | A boolean that mark a layer as walkable. |
Definition at line 523 of file layer.cpp.
References m_walkable.
Referenced by FIFE::MapLoader::load().
void FIFE::Layer::toggleInstancesVisible | ( | ) |
Toggle object visibility.
Definition at line 454 of file layer.cpp.
References m_instancesVisibility, and setInstancesVisible().
bool FIFE::Layer::update | ( | ) |
Called periodically to update events on layer.
Definition at line 594 of file layer.cpp.
References FIFE::ICHANGE_NO_CHANGES, m_activeInstances, m_changed, m_changedInstances, and m_changeListeners.
|
protected |
all the active instances on this layer
Definition at line 392 of file layer.h.
Referenced by setInstanceActivityStatus(), and update().
|
protected |
pointer to cellcache
Definition at line 410 of file layer.h.
Referenced by cellContainsBlockingInstance(), createCellCache(), destroyCellCache(), getBlockingInstances(), getCellCache(), and removeInteractLayer().
|
protected |
true if layer (or it's instance) information was changed during previous update round
Definition at line 416 of file layer.h.
Referenced by addInstance(), createInstance(), deleteInstance(), isChanged(), removeInstance(), and update().
|
protected |
holds changed instances after each update
Definition at line 414 of file layer.h.
Referenced by getChangedInstances(), and update().
|
protected |
listeners for layer changes
Definition at line 412 of file layer.h.
Referenced by addChangeListener(), addInstance(), createInstance(), deleteInstance(), removeChangeListener(), removeInstance(), and update().
|
protected |
layer's cellgrid
Definition at line 396 of file layer.h.
Referenced by getCellGrid(), getInstancesInLine(), setCellGrid(), and setPathingStrategy().
|
protected |
|
protected |
all the instances on this layer
Definition at line 390 of file layer.h.
Referenced by addInstance(), createInstance(), deleteInstance(), getInstance(), getInstances(), getInstancesAt(), getMinMaxCoordinates(), hasInstances(), removeInstance(), setInstancesVisible(), setLayerTransparency(), and ~Layer().
|
protected |
if true the instances are visibility otherwise they are skipped during rendering
Definition at line 386 of file layer.h.
Referenced by areInstancesVisible(), setInstancesVisible(), and toggleInstancesVisible().
|
protected |
The instance tree.
Definition at line 394 of file layer.h.
Referenced by addInstance(), cellContainsBlockingInstance(), createInstance(), deleteInstance(), getBlockingInstances(), getInstancesIn(), getInstancesInCircle(), getInstancesInLine(), getInstanceTree(), removeInstance(), and ~Layer().
|
protected |
is interact true/false
Definition at line 404 of file layer.h.
Referenced by isInteract(), setInteract(), and ~Layer().
|
protected |
all assigned interact layers
Definition at line 408 of file layer.h.
Referenced by addInteractLayer(), destroyCellCache(), getInteractLayers(), and removeInteractLayer().
|
protected |
pointer to map
Definition at line 384 of file layer.h.
Referenced by getLayerCount(), getMap(), getZOffset(), and ~Layer().
|
protected |
pathing strategy for the layer
Definition at line 398 of file layer.h.
Referenced by getPathingStrategy(), and setPathingStrategy().
|
protected |
sorting strategy for rendering
Definition at line 400 of file layer.h.
Referenced by getSortingStrategy(), and setSortingStrategy().
|
protected |
true if layer is static
Definition at line 418 of file layer.h.
Referenced by isStatic(), and setStatic().
|
protected |
transparency, value 0 means total visible, 128 semi-transparent and 255 invisibility
Definition at line 388 of file layer.h.
Referenced by getLayerTransparency(), and setLayerTransparency().
|
protected |
is walkable true/false
Definition at line 402 of file layer.h.
Referenced by addInteractLayer(), createCellCache(), destroyCellCache(), isWalkable(), removeInteractLayer(), and setWalkable().
|
protected |
walkable id
Definition at line 406 of file layer.h.
Referenced by getWalkableId(), setInteract(), and ~Layer().