|
FIFE
|
This class serves as a central place to manage triggers for a Map. More...
#include <triggercontroller.h>
Inheritance diagram for FIFE::TriggerController:
Collaboration diagram for FIFE::TriggerController:Public Member Functions | |
| TriggerController (Map *map) | |
| Constructor. More... | |
| virtual | ~TriggerController () |
| Destructor. More... | |
| Trigger * | createTrigger (const std::string &triggerName) |
| Creates a trigger. More... | |
| Trigger * | createTrigger (const std::string &triggerName, Layer *layer, const ModelCoordinate &pt) |
| Creates and adds a trigger to the cell on the specified layer and coordinate. More... | |
| Trigger * | createTrigger (const std::string &triggerName, Layer *layer, const std::vector< ModelCoordinate > &coords) |
| Creates and adds a trigger to the cells on the specified layer and coordinates. More... | |
| Trigger * | createTrigger (const std::string &triggerName, Layer *layer, const Rect &rec) |
| Creates and adds a trigger to the cells on the specified layer and rect. More... | |
| Trigger * | createTrigger (const std::string &triggerName, const Location &loc) |
| Creates and adds a trigger to the cell on the specified location. More... | |
| Trigger * | createTrigger (const std::string &triggerName, const std::vector< Location > &locs) |
| Creates and adds a trigger to the cell on the specified locations. More... | |
| Trigger * | createTrigger (const std::string &triggerName, Cell *cell) |
| Creates and adds a trigger to the specified cell. More... | |
| Trigger * | createTrigger (const std::string &triggerName, const std::vector< Cell * > &cells) |
| Creates and adds a trigger to the specified cells. More... | |
| Trigger * | createTrigger (const std::string &triggerName, Instance *instance) |
| Creates and attach a trigger to the specified instance. More... | |
| Trigger * | getTrigger (const std::string &triggerName) |
| Returns a pointer to the trigger with the given name. More... | |
| void | deleteTrigger (const std::string &triggerName) |
| Deltes trigger with the given name. More... | |
| void | removeTrigger (const std::string &triggerName, Layer *layer, const ModelCoordinate &pt) |
| Removes a trigger from the cell on the specified layer and coordinate. More... | |
| void | removeTrigger (const std::string &triggerName, Layer *layer, const std::vector< ModelCoordinate > &coords) |
| Removes a trigger from the cell on the specified layer and coordinates. More... | |
| void | removeTrigger (const std::string &triggerName, Layer *layer, const Rect &rec) |
| Removes a trigger from the cell on the specified layer and coordinates. More... | |
| void | removeTrigger (const std::string &triggerName, const Location &loc) |
| Removes a trigger from the cell on the specified location. More... | |
| void | removeTrigger (const std::string &triggerName, const std::vector< Location > &locs) |
| Removes a trigger from the cell on the specified locations. More... | |
| void | removeTrigger (const std::string &triggerName, Cell *cell) |
| Removes a trigger from the specified cell. More... | |
| void | removeTrigger (const std::string &triggerName, const std::vector< Cell * > &cells) |
| Removes a trigger from the specified cells. More... | |
| void | removeTrigger (const std::string &triggerName, Instance *instance) |
| Detach a trigger from the specified instance. More... | |
| std::vector< Trigger * > | getAllTriggers () |
| Returns a vector with all trigger pointers. More... | |
| std::vector< std::string > | getAllTriggerNames () |
| Returns a vector with all trigger names. More... | |
Public Member Functions inherited from FIFE::FifeClass | |
| FifeClass () | |
| virtual | ~FifeClass () |
| fifeid_t | getFifeId () |
| Gets unique id of this instance inside the engine. More... | |
Private Types | |
| typedef std::map< std::string, Trigger * > | TriggerNameMap |
| typedef std::map< std::string, Trigger * >::iterator | TriggerNameMapIterator |
| typedef std::map< std::string, Trigger * >::const_iterator | TriggerNameMapConstIterator |
| typedef std::pair< std::string, Trigger * > | TriggerNameMapPair |
Private Member Functions | |
| bool | exists (const std::string &name) |
| Checks to see if the trigger name already exists. More... | |
Private Attributes | |
| Map * | m_map |
| Pointer to the map this controller is associated with. More... | |
| TriggerNameMap | m_triggerNameMap |
| Trigger name map. More... | |
This class serves as a central place to manage triggers for a Map.
You should never instantiate this class directly as Map does it when you create a new map.
Definition at line 55 of file triggercontroller.h.
|
private |
Definition at line 227 of file triggercontroller.h.
|
private |
Definition at line 229 of file triggercontroller.h.
|
private |
Definition at line 228 of file triggercontroller.h.
|
private |
Definition at line 230 of file triggercontroller.h.
| FIFE::TriggerController::TriggerController | ( | Map * | map | ) |
Constructor.
| map | A pointer to the map that the controller will interact with. |
Definition at line 43 of file triggercontroller.cpp.
|
virtual |
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName | ) |
Creates a trigger.
| triggerName | The name of the trigger. This must be unique per map. |
Definition at line 54 of file triggercontroller.cpp.
References FIFE::_log, FL_WARN, and m_triggerNameMap.
Referenced by createTrigger(), and FIFE::MapLoader::load().
Here is the caller graph for this function:| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const ModelCoordinate & | pt | ||
| ) |
Creates and adds a trigger to the cell on the specified layer and coordinate.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to add the Trigger to |
| pt | The ModelCoordinate where the Trigger should be added. |
Definition at line 70 of file triggercontroller.cpp.
References FIFE::Trigger::assign(), and createTrigger().
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const std::vector< ModelCoordinate > & | coords | ||
| ) |
Creates and adds a trigger to the cells on the specified layer and coordinates.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to add the Trigger to |
| coords | Vector with ModelCoordinates where the Trigger should be added. |
Definition at line 78 of file triggercontroller.cpp.
References FIFE::Trigger::assign(), and createTrigger().
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const Rect & | rec | ||
| ) |
Creates and adds a trigger to the cells on the specified layer and rect.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to add the Trigger to |
| rec | a Rect with ModelCoordinates where the Trigger should be added. |
Definition at line 88 of file triggercontroller.cpp.
References createTrigger(), FIFE::Layer::getCellCache(), and FIFE::CellCache::getCellsInRect().
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| const Location & | loc | ||
| ) |
Creates and adds a trigger to the cell on the specified location.
| triggerName | The name of the trigger. This must be unique per map. |
| loc | The Location where the Trigger should be added. |
Definition at line 100 of file triggercontroller.cpp.
References createTrigger(), FIFE::Layer::getCellCache(), FIFE::Location::getLayer(), and FIFE::Location::getLayerCoordinates().
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| const std::vector< Location > & | locs | ||
| ) |
Creates and adds a trigger to the cell on the specified locations.
| triggerName | The name of the trigger. This must be unique per map. |
| locs | Vector with Locations where the Trigger should be added. |
Definition at line 109 of file triggercontroller.cpp.
References FIFE::Trigger::assign(), and createTrigger().
Creates and adds a trigger to the specified cell.
| triggerName | The name of the trigger. This must be unique per map. |
| cell | The Cell where the Trigger should be added. |
Definition at line 117 of file triggercontroller.cpp.
References FIFE::Trigger::assign(), and createTrigger().
| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| const std::vector< Cell * > & | cells | ||
| ) |
Creates and adds a trigger to the specified cells.
| triggerName | The name of the trigger. This must be unique per map. |
| cells | Vector with Cell pointers where the Trigger should be added. |
Definition at line 125 of file triggercontroller.cpp.
References FIFE::Trigger::assign(), and createTrigger().
Referenced by createTrigger().
Here is the caller graph for this function:| Trigger * FIFE::TriggerController::createTrigger | ( | const std::string & | triggerName, |
| Instance * | instance | ||
| ) |
Creates and attach a trigger to the specified instance.
But not to the underlaying cell.
| triggerName | The name of the trigger. This must be unique per map. |
| instance | The Instance where the Trigger is attached to. |
Definition at line 133 of file triggercontroller.cpp.
References FIFE::Trigger::attach(), and createTrigger().
| void FIFE::TriggerController::deleteTrigger | ( | const std::string & | triggerName | ) |
Deltes trigger with the given name.
| triggerName | The name of the trigger. This must be unique per map. |
Definition at line 149 of file triggercontroller.cpp.
References m_triggerNameMap.
|
private |
Checks to see if the trigger name already exists.
| name | The name of the trigger to check |
Definition at line 242 of file triggercontroller.cpp.
References m_triggerNameMap.
| std::vector< std::string > FIFE::TriggerController::getAllTriggerNames | ( | ) |
Returns a vector with all trigger names.
Definition at line 233 of file triggercontroller.cpp.
References m_triggerNameMap.
| std::vector< Trigger * > FIFE::TriggerController::getAllTriggers | ( | ) |
Returns a vector with all trigger pointers.
Definition at line 224 of file triggercontroller.cpp.
References m_triggerNameMap.
Referenced by FIFE::MapSaver::save().
Here is the caller graph for this function:| Trigger * FIFE::TriggerController::getTrigger | ( | const std::string & | triggerName | ) |
Returns a pointer to the trigger with the given name.
Note: Returns Null if the trigger does not exists.
| triggerName | The name of the trigger. This must be unique per map. |
Definition at line 141 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const ModelCoordinate & | pt | ||
| ) |
Removes a trigger from the cell on the specified layer and coordinate.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to remove the Trigger from. |
| pt | The ModelCoordinate where the Trigger should be removed. |
Definition at line 157 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const std::vector< ModelCoordinate > & | coords | ||
| ) |
Removes a trigger from the cell on the specified layer and coordinates.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to remove the Trigger from. |
| coords | Vector with ModelCoordinates where the Trigger should be removed. |
Definition at line 164 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| Layer * | layer, | ||
| const Rect & | rec | ||
| ) |
Removes a trigger from the cell on the specified layer and coordinates.
| triggerName | The name of the trigger. This must be unique per map. |
| layer | A pointer to the layer in which to remove the Trigger from. |
| rec | Rect with ModelCoordinates where the Trigger should be removed. |
Definition at line 173 of file triggercontroller.cpp.
References FIFE::Layer::getCellCache(), FIFE::CellCache::getCellsInRect(), and m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| const Location & | loc | ||
| ) |
Removes a trigger from the cell on the specified location.
| triggerName | The name of the trigger. This must be unique per map. |
| loc | Location where the Trigger should be removed. |
Definition at line 183 of file triggercontroller.cpp.
References FIFE::Location::getLayer(), FIFE::Location::getLayerCoordinates(), and m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| const std::vector< Location > & | locs | ||
| ) |
Removes a trigger from the cell on the specified locations.
| triggerName | The name of the trigger. This must be unique per map. |
| locs | Vector with Locations where the Trigger should be removed. |
Definition at line 190 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| Cell * | cell | ||
| ) |
Removes a trigger from the specified cell.
| triggerName | The name of the trigger. This must be unique per map. |
| cell | The Cell pointer where the Trigger should be removed. |
Definition at line 199 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| const std::vector< Cell * > & | cells | ||
| ) |
Removes a trigger from the specified cells.
| triggerName | The name of the trigger. This must be unique per map. |
| cells | Vector with Cell pointers where the Trigger should be removed. |
Definition at line 206 of file triggercontroller.cpp.
References m_triggerNameMap.
| void FIFE::TriggerController::removeTrigger | ( | const std::string & | triggerName, |
| Instance * | instance | ||
| ) |
Detach a trigger from the specified instance.
| triggerName | The name of the trigger. This must be unique per map. |
| instance | The instance pointer where the Trigger is detached from. |
Definition at line 215 of file triggercontroller.cpp.
References m_triggerNameMap.
|
private |
Pointer to the map this controller is associated with.
Definition at line 225 of file triggercontroller.h.
|
private |
Trigger name map.
Definition at line 233 of file triggercontroller.h.
Referenced by createTrigger(), deleteTrigger(), exists(), getAllTriggerNames(), getAllTriggers(), getTrigger(), removeTrigger(), and ~TriggerController().