63 std::find(restrict.begin(), restrict.end(), instance) != restrict.end()) {
75 std::find(restrict.begin(), restrict.end(), instance) != restrict.end()) {
149 std::vector<Cell*>::iterator it =
m_assigned.begin();
166 if ((*i) == listener) {
320 std::vector<Cell*> newCells;
321 std::vector<Cell*>::iterator it =
m_assigned.begin();
328 newCells.push_back(c);
331 for (it = newCells.begin(); it != newCells.end(); ++it) {
TriggerChangeListener(Trigger *trigger)
void detach()
Detaches trigger from instance.
TriggerChangeListener * m_changeListener
main change listener (cell and instance listener)
void move()
Callback for TriggerChangeListener.
Layer * getLayer() const
Gets the layer where this location is pointing to.
void attach(Instance *instance)
Attaches the trigger to the given instance.
void addDeleteListener(InstanceDeleteListener *listener)
Adds new instance delete listener.
std::string m_name
name of the trigger. This should be unique per Map.
Listener interface for changes happening on a cell.
A CellCache is an abstract depiction of one or a few layers and contains additional information...
virtual ~Trigger()
Destructor.
void enableForInstance(Instance *instance)
Enables trigger for given instance.
CellCache * getCellCache()
Returns the CellCache of this layer.
void addTriggerCondition(TriggerCondition type)
Adds trigger condition.
void removeTriggerCondition(TriggerCondition type)
Removes trigger condition.
void addChangeListener(CellChangeListener *listener)
Adds new cell change listener.
void remove(Layer *layer, const ModelCoordinate &pt)
Removes trigger from given layer and position.
virtual ~TriggerChangeListener()
Location & getLocationRef()
Gets reference of current location of instance.
virtual void onInstanceDeleted(Instance *instance)
void removeDeleteListener(InstanceDeleteListener *listener)
Removes associated instance delete listener.
const std::vector< Cell * > & getAssignedCells()
Returns vector with the cells where the trigger is assigned to.
void addChangeListener(InstanceChangeListener *listener)
Adds new instance change listener.
std::vector< ITriggerListener * > m_triggerListeners
Vector of the listeners that get called.
virtual void onInstanceChanged(Instance *instance, InstanceChangeInfo info)
uint32_t InstanceChangeInfo
Cell * getCell(const ModelCoordinate &mc)
Returns cell on this coordinate.
Location & getOldLocationRef()
Gets reference of old location of instance.
bool m_enabledAll
true if the trigger is enabled for all instances
void removeChangeListener(InstanceChangeListener *listener)
Removes associated instance change listener.
void assign(Layer *layer, const ModelCoordinate &pt)
Assigns trigger on given layer and position.
const std::vector< TriggerCondition > & getTriggerConditions()
Returns trigger conditions in an vector.
A basic cell on a CellCache.
std::vector< Instance * > m_enabledInstances
all enabled instances
Instance * m_attached
instance where the trigger is attached to
Instance * getAttached()
Returns pointer to instance where the trigger is attached to.
void moveTo(const ModelCoordinate &newPos, const ModelCoordinate &oldPos)
Moves the trigger from the old position to the new position.
const std::vector< Instance * > & getEnabledInstances()
Returns instance which the trigger is enabled for.
void disableForAllInstances()
Disables trigger for all instances.
void reset()
Reset trigger.
virtual void onBlockingChangedCell(Cell *cell, CellTypeInfo type, bool blocks)
Called when some instance changed its blocking property.
std::vector< TriggerCondition > m_triggerConditions
all trigger conditions
Trigger()
Default constructor.
void removeTriggerListener(ITriggerListener *listener)
Removes a listener from the trigger.
Trigger get triggered when a specific set of criteria are met.
void disableForInstance(Instance *instance)
Disables trigger for given instance.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
void enableForAllInstances()
Enables trigger for all instances.
bool m_triggered
true if this trigger has been triggered
virtual void onInstanceExitedCell(Cell *cell, Instance *instance)
Called when some instance exited the cell.
void addTriggerListener(ITriggerListener *listener)
Add a listener to the trigger.
An Instance is an "instantiation" of an Object at a Location.
bool isEnabledForAllInstances()
Returns if trigger is enabled for all instances.
void removeChangeListener(CellChangeListener *listener)
Removes cell change listener.
void setTriggered()
Sets the trigger to triggered and calls ITriggerListener->onTriggered()
virtual void onInstanceEnteredCell(Cell *cell, Instance *instance)
Called when some instance entered the cell.
std::vector< Cell * > m_assigned
cells in which the trigger is assigned