FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::Layer Class Reference

A basic layer on a map. More...

#include <layer.h>

+ Inheritance diagram for FIFE::Layer:
+ Collaboration diagram for FIFE::Layer:

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...
 
MapgetMap () const
 Get the map this layer is contained in. More...
 
CellGridgetCellGrid () const
 Get the Cellgrid. More...
 
void setCellGrid (CellGrid *grid)
 Set the Cellgrid. More...
 
InstanceTreegetInstanceTree (void) const
 Get the instance tree. More...
 
bool hasInstances () const
 Check existance of objects on this layer. More...
 
InstancecreateInstance (Object *object, const ModelCoordinate &p, const std::string &id="")
 Add an instance of an object at a specific position. More...
 
InstancecreateInstance (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 &center, uint16_t radius)
 Returns instances that match given center and radius of the circle. More...
 
std::vector< Instance * > getInstancesInCircleSegment (const ModelCoordinate &center, uint16_t radius, int32_t sangle, int32_t eangle)
 Returns all instances in the circle segment. More...
 
InstancegetInstance (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...
 
CellCachegetCellCache ()
 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...
 
Mapm_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...
 
InstanceTreem_instanceTree
 The instance tree. More...
 
CellGridm_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...
 
CellCachem_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...
 

Detailed Description

A basic layer on a map.

Definition at line 99 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

FIFE::Layer::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.

Definition at line 48 of file layer.cpp.

◆ ~Layer()

FIFE::Layer::~Layer ( )

Member Function Documentation

◆ addChangeListener()

void FIFE::Layer::addChangeListener ( LayerChangeListener listener)

Adds new change listener.

Parameters
listenerto add

Definition at line 628 of file layer.cpp.

References m_changeListeners.

Referenced by FIFE::CellCache::addInteractOnRuntime(), FIFE::CellCache::CellCache(), and FIFE::LayerCache::setLayer().

+ Here is the caller graph for this function:

◆ addInstance()

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().

+ Here is the caller graph for this function:

◆ addInteractLayer()

void FIFE::Layer::addInteractLayer ( Layer layer)

Adds a interact layer to the walkable layer.

Parameters
layerA 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().

+ Here is the caller graph for this function:

◆ areInstancesVisible()

bool FIFE::Layer::areInstancesVisible ( ) const

Check object visibility.

See also
setObjectsVisible

Definition at line 458 of file layer.cpp.

References m_instancesVisibility.

Referenced by FIFE::LightRenderer::render().

+ Here is the caller graph for this function:

◆ cellContainsBlockingInstance()

bool FIFE::Layer::cellContainsBlockingInstance ( const ModelCoordinate cellCoordinate)

Determines if a given cell on the layer contains a blocking instance.

Parameters
cellCoordinateA const reference to a model coordinate of the cell in question.
Returns
A boolean, true if it is blocked false otherwise.

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().

+ Here is the caller graph for this function:

◆ createCellCache()

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.

◆ createInstance() [1/2]

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().

+ Here is the caller graph for this function:

◆ createInstance() [2/2]

Instance * FIFE::Layer::createInstance ( Object object,
const ExactModelCoordinate p,
const std::string &  id = "" 
)

◆ deleteInstance()

void FIFE::Layer::deleteInstance ( Instance instance)

◆ destroyCellCache()

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().

+ Here is the caller graph for this function:

◆ getBlockingInstances()

std::vector< Instance * > FIFE::Layer::getBlockingInstances ( const ModelCoordinate cellCoordinate)

Returns instances that blocks on given cell.

Parameters
cellCoordinateA const reference to a model coordinate of the cell in question.
Returns
A vector that contains instances.

Definition at line 482 of file layer.cpp.

References FIFE::InstanceTree::findInstances(), FIFE::CellCache::getCell(), FIFE::Cell::getInstances(), m_cellCache, and m_instanceTree.

◆ getCellCache()

CellCache * FIFE::Layer::getCellCache ( )

◆ getCellGrid()

◆ getChangedInstances()

std::vector< Instance * > & FIFE::Layer::getChangedInstances ( )

Returns instances that were changed during previous update round.

Note
does not contain created or deleted instances

Definition at line 647 of file layer.cpp.

References m_changedInstances.

◆ getId()

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().

+ Here is the caller graph for this function:

◆ getInstance()

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().

+ Here is the caller graph for this function:

◆ getInstances() [1/2]

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.

◆ getInstances() [2/2]

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.

◆ getInstancesAt()

std::vector< Instance * > FIFE::Layer::getInstancesAt ( Location loc,
bool  use_exactcoordinates = false 
)

Returns instances that match given location.

Parameters
loclocation where to fetch instances from
use_exactcoordinatesif 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.

◆ getInstancesIn()

std::list< Instance * > FIFE::Layer::getInstancesIn ( Rect rec)

Returns instances that match given rect.

Parameters
recrect 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.

◆ getInstancesInCircle()

std::vector< Instance * > FIFE::Layer::getInstancesInCircle ( const ModelCoordinate center,
uint16_t  radius 
)

Returns instances that match given center and radius of the circle.

Parameters
centerA const reference to the ModelCoordinate where the center of the circle is.
radiusA unsigned integer, radius of the circle.
Returns
A vector that contain the instances.

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().

+ Here is the caller graph for this function:

◆ 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.

Parameters
centerA const reference to the ModelCoordinate where the center of the circle is.
radiusA unsigned integer, radius of the circle.
sangleA interger, start angle of the segment.
eangleA interger, end angle of the segment.
Returns
A vector that contain the instances.

Definition at line 363 of file layer.cpp.

References FIFE::getAngleBetween(), getInstancesInCircle(), FIFE::intPt2doublePt(), FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.

◆ getInstancesInLine()

std::vector< Instance * > FIFE::Layer::getInstancesInLine ( const ModelCoordinate pt1,
const ModelCoordinate pt2 
)

Returns instances that match given line between pt1 and pt2.

Parameters
pt1A const reference to the ModelCoordinate where to start from.
pt2A const reference to the ModelCoordinate where the end is.
Returns
A vector that contain the instances.

Definition at line 288 of file layer.cpp.

References FIFE::InstanceTree::findInstances(), FIFE::CellGrid::getCoordinatesInLine(), m_grid, and m_instanceTree.

◆ getInstanceTree()

InstanceTree * FIFE::Layer::getInstanceTree ( void  ) const

Get the instance tree.

Returns
this layers 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().

+ Here is the caller graph for this function:

◆ getInteractLayers()

const std::vector< Layer * > & FIFE::Layer::getInteractLayers ( )

Returns all assigned interact layer.

Returns
A const reference to a vector with pointers to interact layers.

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().

+ Here is the caller graph for this function:

◆ getLayerCount()

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.

◆ getLayerTransparency()

uint8_t FIFE::Layer::getLayerTransparency ( )

Returns the layer's transparency value.

Definition at line 450 of file layer.cpp.

References m_transparency.

◆ getMap()

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().

+ Here is the caller graph for this function:

◆ getMinMaxCoordinates()

void FIFE::Layer::getMinMaxCoordinates ( ModelCoordinate min,
ModelCoordinate max,
const Layer layer = 0 
) const

Retrieves the minimum/maximum coordinates of instances on the layer.

Parameters
minA reference to a ModelCoordinate that will hold the minimum coordinate.
maxA reference to a ModelCoordinate that will hold the maximum coordinate.
layerA 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().

+ Here is the caller graph for this function:

◆ getPathingStrategy()

PathingStrategy FIFE::Layer::getPathingStrategy ( ) const

Gets pathing strategy for the layer.

See also
PathingStrategy

Definition at line 511 of file layer.cpp.

References m_pathingStrategy.

◆ getSortingStrategy()

SortingStrategy FIFE::Layer::getSortingStrategy ( ) const

Gets sorting strategy for the layer.

See also
SortingStrategy

Definition at line 519 of file layer.cpp.

References m_sortingStrategy.

◆ getWalkableId()

const std::string & FIFE::Layer::getWalkableId ( )

Returns the id of the walkable layer if this is a interact layer otherwise the string is empty.

Returns
A const reference to a string that refer to the id of the walkable layer.

Definition at line 540 of file layer.cpp.

References m_walkableId.

◆ getZOffset()

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.

◆ hasInstances()

bool FIFE::Layer::hasInstances ( ) const

Check existance of objects on this layer.

Returns
True, if objects exist.

Definition at line 105 of file layer.cpp.

References m_instances.

◆ isChanged()

bool FIFE::Layer::isChanged ( )

Returns true, if layer information was changed during previous update round.

Definition at line 643 of file layer.cpp.

References m_changed.

◆ isInteract()

bool FIFE::Layer::isInteract ( )

Returns if a layer is interact.

Returns
A boolean, true if the layer is interact otherwise false.

Definition at line 536 of file layer.cpp.

References m_interact.

◆ isStatic()

bool FIFE::Layer::isStatic ( )

Returns true, if layer is static.

Returns
A boolean, true if the layer is static, otherwise false.

Definition at line 655 of file layer.cpp.

References m_static.

◆ isWalkable()

bool FIFE::Layer::isWalkable ( )

Returns if a layer is walkable.

Returns
A boolean, true if the layer is walkable otherwise false.

Definition at line 527 of file layer.cpp.

References m_walkable.

◆ removeChangeListener()

void FIFE::Layer::removeChangeListener ( LayerChangeListener listener)

Removes associated change listener.

Parameters
listenerto remove

Definition at line 632 of file layer.cpp.

References m_changeListeners.

Referenced by destroyCellCache(), and FIFE::CellCache::~CellCache().

+ Here is the caller graph for this function:

◆ removeInstance()

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().

+ Here is the caller graph for this function:

◆ removeInteractLayer()

void FIFE::Layer::removeInteractLayer ( Layer layer)

Removes a interact layer from the walkable layer.

Parameters
layerA 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().

+ Here is the caller graph for this function:

◆ setCellGrid()

void FIFE::Layer::setCellGrid ( CellGrid grid)

Set the Cellgrid.

Definition at line 97 of file layer.cpp.

References m_grid.

◆ setId()

void FIFE::Layer::setId ( const std::string &  id)

Sets the identifier for this layer.

Definition at line 85 of file layer.cpp.

References m_id.

◆ setInstanceActivityStatus()

void FIFE::Layer::setInstanceActivityStatus ( Instance instance,
bool  active 
)

Sets the activity status for given instance on this layer.

Parameters
instanceA pointer to the Instance whose activity is to be changed.
activeA 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().

+ Here is the caller graph for this function:

◆ setInstancesVisible()

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().

+ Here is the caller graph for this function:

◆ setInteract()

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.

Parameters
interactA boolean that mark a layer as interact.
idA 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().

+ Here is the caller graph for this function:

◆ setLayerTransparency()

void FIFE::Layer::setLayerTransparency ( uint8_t  transparency)

Sets the transparency of all instances on the layer.

0=opaque, 255=transparent

Parameters
transparencyTransparency value from 0-255.

Definition at line 440 of file layer.cpp.

References m_instances, and m_transparency.

◆ setPathingStrategy()

void FIFE::Layer::setPathingStrategy ( PathingStrategy  strategy)

Sets pathing strategy for the layer.

See also
PathingStrategy

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().

+ Here is the caller graph for this function:

◆ setSortingStrategy()

void FIFE::Layer::setSortingStrategy ( SortingStrategy  strategy)

Sets sorting strategy for the layer.

See also
SortingStrategy

Definition at line 515 of file layer.cpp.

References m_sortingStrategy.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

◆ setStatic()

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.

Parameters
statiA boolean, true if the layer should be static.

Definition at line 651 of file layer.cpp.

References m_static.

◆ setWalkable()

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.

Parameters
walkableA boolean that mark a layer as walkable.

Definition at line 523 of file layer.cpp.

References m_walkable.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

◆ toggleInstancesVisible()

void FIFE::Layer::toggleInstancesVisible ( )

Toggle object visibility.

See also
setObjectsVisible

Definition at line 454 of file layer.cpp.

References m_instancesVisibility, and setInstancesVisible().

◆ update()

bool FIFE::Layer::update ( )

Called periodically to update events on layer.

Returns
true if layer was changed since the last update, false otherwise

Definition at line 594 of file layer.cpp.

References FIFE::ICHANGE_NO_CHANGES, m_activeInstances, m_changed, m_changedInstances, and m_changeListeners.

Member Data Documentation

◆ m_activeInstances

std::set<Instance*> FIFE::Layer::m_activeInstances
protected

all the active instances on this layer

Definition at line 392 of file layer.h.

Referenced by setInstanceActivityStatus(), and update().

◆ m_cellCache

CellCache* FIFE::Layer::m_cellCache
protected

◆ m_changed

bool FIFE::Layer::m_changed
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().

◆ m_changedInstances

std::vector<Instance*> FIFE::Layer::m_changedInstances
protected

holds changed instances after each update

Definition at line 414 of file layer.h.

Referenced by getChangedInstances(), and update().

◆ m_changeListeners

std::vector<LayerChangeListener*> FIFE::Layer::m_changeListeners
protected

listeners for layer changes

Definition at line 412 of file layer.h.

Referenced by addChangeListener(), addInstance(), createInstance(), deleteInstance(), removeChangeListener(), removeInstance(), and update().

◆ m_grid

CellGrid* FIFE::Layer::m_grid
protected

layer's cellgrid

Definition at line 396 of file layer.h.

Referenced by getCellGrid(), getInstancesInLine(), setCellGrid(), and setPathingStrategy().

◆ m_id

std::string FIFE::Layer::m_id
protected

string identifier

Definition at line 382 of file layer.h.

Referenced by getId(), and setId().

◆ m_instances

std::vector<Instance*> FIFE::Layer::m_instances
protected

◆ m_instancesVisibility

bool FIFE::Layer::m_instancesVisibility
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().

◆ m_instanceTree

◆ m_interact

bool FIFE::Layer::m_interact
protected

is interact true/false

Definition at line 404 of file layer.h.

Referenced by isInteract(), setInteract(), and ~Layer().

◆ m_interacts

std::vector<Layer*> FIFE::Layer::m_interacts
protected

all assigned interact layers

Definition at line 408 of file layer.h.

Referenced by addInteractLayer(), destroyCellCache(), getInteractLayers(), and removeInteractLayer().

◆ m_map

Map* FIFE::Layer::m_map
protected

pointer to map

Definition at line 384 of file layer.h.

Referenced by getLayerCount(), getMap(), getZOffset(), and ~Layer().

◆ m_pathingStrategy

PathingStrategy FIFE::Layer::m_pathingStrategy
protected

pathing strategy for the layer

Definition at line 398 of file layer.h.

Referenced by getPathingStrategy(), and setPathingStrategy().

◆ m_sortingStrategy

SortingStrategy FIFE::Layer::m_sortingStrategy
protected

sorting strategy for rendering

Definition at line 400 of file layer.h.

Referenced by getSortingStrategy(), and setSortingStrategy().

◆ m_static

bool FIFE::Layer::m_static
protected

true if layer is static

Definition at line 418 of file layer.h.

Referenced by isStatic(), and setStatic().

◆ m_transparency

uint8_t FIFE::Layer::m_transparency
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().

◆ m_walkable

bool FIFE::Layer::m_walkable
protected

is walkable true/false

Definition at line 402 of file layer.h.

Referenced by addInteractLayer(), createCellCache(), destroyCellCache(), isWalkable(), removeInteractLayer(), and setWalkable().

◆ m_walkableId

std::string FIFE::Layer::m_walkableId
protected

walkable id

Definition at line 406 of file layer.h.

Referenced by getWalkableId(), setInteract(), and ~Layer().


The documentation for this class was generated from the following files: