112 const std::string&
getId()
const;
116 void setId(
const std::string&
id);
168 std::vector<Instance*>
getInstances(
const std::string&
id);
270 void setInteract(
bool interact,
const std::string&
id);
void setInstancesVisible(bool vis)
Set object visibility.
SortingStrategy m_sortingStrategy
sorting strategy for rendering
std::vector< LayerChangeListener * > m_changeListeners
listeners for layer changes
Map * getMap() const
Get the map this layer is contained in.
bool isChanged()
Returns true, if layer information was changed during previous update round.
bool m_walkable
is walkable true/false
bool m_static
true if layer is static
std::vector< Instance * > getInstancesAt(Location &loc, bool use_exactcoordinates=false)
Returns instances that match given location.
InstanceTree * m_instanceTree
The instance tree.
~Layer()
Destructs a Layer instance.
std::vector< Instance * > & getChangedInstances()
Returns instances that were changed during previous update round.
void setId(const std::string &id)
Sets the identifier for this layer.
A CellCache is an abstract depiction of one or a few layers and contains additional information...
void toggleInstancesVisible()
Toggle object visibility.
void setSortingStrategy(SortingStrategy strategy)
Sets sorting strategy for the layer.
bool hasInstances() const
Check existance of objects on this layer.
void destroyCellCache()
Destroys the CellCache of this layer.
std::list< Instance * > getInstancesIn(Rect &rec)
Returns instances that match given rect.
CellCache * getCellCache()
Returns the CellCache of this layer.
void createCellCache()
Called from Map to create a CellCache.
Base class for all fife classes Used e.g.
Instance * createInstance(Object *object, const ModelCoordinate &p, const std::string &id="")
Add an instance of an object at a specific position.
CellGrid * m_grid
layer's cellgrid
bool m_instancesVisibility
if true the instances are visibility otherwise they are skipped during rendering
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...
bool areInstancesVisible() const
Check object visibility.
InstanceTree * getInstanceTree(void) const
Get the instance tree.
CellCache * m_cellCache
pointer to cellcache
virtual void onInstanceDelete(Layer *layer, Instance *instance)=0
Called when some instance gets deleted on layer.
void setCellGrid(CellGrid *grid)
Set the Cellgrid.
std::set< Instance * > m_activeInstances
all the active instances on this layer
bool update()
Called periodically to update events on layer.
void addInteractLayer(Layer *layer)
Adds a interact layer to the walkable layer.
std::vector< Instance * > getBlockingInstances(const ModelCoordinate &cellCoordinate)
Returns instances that blocks on given cell.
uint8_t m_transparency
transparency, value 0 means total visible, 128 semi-transparent and 255 invisibility ...
void removeInstance(Instance *instance)
Remove an instance from the layer.
void setPathingStrategy(PathingStrategy strategy)
Sets pathing strategy for the layer.
void getMinMaxCoordinates(ModelCoordinate &min, ModelCoordinate &max, const Layer *layer=0) const
Retrieves the minimum/maximum coordinates of instances on the layer.
void setStatic(bool stati)
Marks this layer as visual static.
void removeChangeListener(LayerChangeListener *listener)
Removes associated change listener.
virtual void onLayerChanged(Layer *layer, std::vector< Instance * > &changedInstances)=0
Called when some instance is changed on layer.
bool addInstance(Instance *instance, const ExactModelCoordinate &p)
Add a valid instance at a specific position.
const std::string & getWalkableId()
Returns the id of the walkable layer if this is a interact layer otherwise the string is empty...
bool m_changed
true if layer (or it's instance) information was changed during previous update round ...
Instance * getInstance(const std::string &identifier)
Get the first instance on this layer with the given identifier.
bool isWalkable()
Returns if a layer is walkable.
Listener interface for changes happening on a layer.
void addChangeListener(LayerChangeListener *listener)
Adds new change listener.
bool isStatic()
Returns true, if layer is static.
void setLayerTransparency(uint8_t transparency)
Sets the transparency of all instances on the layer.
CellGrid * getCellGrid() const
Get the Cellgrid.
PathingStrategy getPathingStrategy() const
Gets pathing strategy for the layer.
void setInteract(bool interact, const std::string &id)
Sets interact for the layer.
const std::vector< Layer * > & getInteractLayers()
Returns all assigned interact layer.
void setWalkable(bool walkable)
Sets walkable for the layer.
std::string m_id
string identifier
bool m_interact
is interact true/false
PathingStrategy
Defines how pathing can be performed on this layer.
const std::string & getId() const
Get the id of this layer.
SortingStrategy getSortingStrategy() const
Gets sorting strategy for the layer.
std::vector< Instance * > m_instances
all the instances on this layer
const std::vector< Instance * > & getInstances() const
Get the list of instances on this layer.
bool cellContainsBlockingInstance(const ModelCoordinate &cellCoordinate)
Determines if a given cell on the layer contains a blocking instance.
void removeInteractLayer(Layer *layer)
Removes a interact layer from the walkable layer.
std::vector< Layer * > m_interacts
all assigned interact layers
virtual ~LayerChangeListener()
void setInstanceActivityStatus(Instance *instance, bool active)
Sets the activity status for given instance on this layer.
virtual void onInstanceCreate(Layer *layer, Instance *instance)=0
Called when some instance gets created on layer.
void deleteInstance(Instance *instance)
Remove an instance from the layer and delete it.
PathingStrategy m_pathingStrategy
pathing strategy for the layer
bool isInteract()
Returns if a layer is interact.
uint8_t getLayerTransparency()
Returns the layer's transparency value.
Map * m_map
pointer to map
An Instance is an "instantiation" of an Object at a Location.
std::string m_walkableId
walkable id
std::vector< Instance * > m_changedInstances
holds changed instances after each update