39 m_namespace(name_space),
41 m_inherited(inherited),
47 m_defaultAction(NULL),
52 m_restrictedRotation(false),
59 std::map<std::string, Action*>::const_iterator i(
m_actions->begin());
71 m_actions =
new std::map<std::string, Action*>;
74 std::map<std::string, Action*>::const_iterator it =
m_actions->begin();
76 if(identifier == it->second->getId()) {
77 throw NameClash(identifier);
83 a =
new Action(identifier);
84 (*m_actions)[identifier] = a;
93 std::map<std::string, Action*>::const_iterator i;
107 std::list<std::string> action_ids;
110 std::map<std::string, Action*>::const_iterator actions_it =
m_actions->begin();
111 for(; actions_it !=
m_actions->end(); ++actions_it) {
112 action_ids.push_back(actions_it->first);
119 std::map<std::string, Action*>::const_iterator i;
258 std::vector<ModelCoordinate> coordinates;
261 std::pair<std::multimap<int32_t, ModelCoordinate>::iterator,
263 std::multimap<int32_t, ModelCoordinate>::iterator it = result.first;
264 for (; it != result.second; ++it) {
265 coordinates.push_back((*it).second);
272 std::set<Object*>::iterator subit =
m_multiParts.begin();
274 const std::multimap<int32_t, ModelCoordinate>& subcoords = (*subit)->getMultiPartCoordinates();
284 std::vector<ModelCoordinate> coordinates;
285 std::pair<std::multimap<int32_t, ModelCoordinate>::iterator,
287 std::multimap<int32_t, ModelCoordinate>::iterator it = result.first;
289 coordinates.push_back(parent);
290 for (; it != result.second; ++it) {
291 coordinates.push_back((*it).second);
double m_cost
cost value, default 1.0
void setDefaultAction(const std::string &identifier)
Sets default action assigned to this object.
double getCost() const
Returns the cost.
void removeMultiPart(Object *obj)
Removes a multi part object.
void removeWalkableArea(const std::string &id)
Removes an area id from walkable areas.
void setArea(const std::string &id)
Sets the area id that the instances of this object adds to their cells.
const std::string & getNamespace() const
bool m_restrictedRotation
indicates if object uses only restricted rotations
void setRotationAnchor(const ExactModelCoordinate &anchor)
Sets the rotation anchor for this multi object.
const std::string & getId() const
type_angle2id m_partAngleMap
part object angles
bool isMultiObject() const
Gets if object uses special cost.
bool isStatic() const
Gets if object moves.
void setCellStackPosition(uint8_t position)
Sets the cell stack position.
const std::list< std::string > & getMultiPartIds() const
Returns all multi part identifiers.
void setZStepRange(int32_t zRange)
Sets z-step range for object.
std::list< std::string > m_multiPartIds
list with part identifiers
const std::set< Object * > & getMultiParts() const
Returns all multi part objects.
std::list< std::string > m_walkableAreas
Object(const std::string &identifier, const std::string &name_space, Object *inherited=NULL)
Constructor An object may optionally inherit default attributes from another object.
void setFilename(const std::string &file)
bool operator!=(const Object &obj) const
Compares unequality of two objects.
bool isMultiPart() const
Gets if object is a part of a multi object.
std::string m_namespace
namespace
const std::string & getFilename() const
std::multimap< int32_t, ModelCoordinate > m_multiPartCoordinates
part object coordinates
void removeAllMultiPartIds()
Removes all multi part identifiers.
void removeMultiPartId(const std::string &partId)
Removes a multi part identifier.
std::multimap< int32_t, ModelCoordinate > m_multiObjectCoordinates
multi object coordinates
void setMultiPart(bool part)
Sets the object as a part of a multi object.
std::string m_id
identifier
const std::string & getCostId() const
Returns the cost id.
const std::multimap< int32_t, ModelCoordinate > & getMultiPartCoordinates() const
Returns all rotationally dependent coordinates from this object part.
void setRestrictedRotation(bool restrict)
Sets the rotation to restricted.
void addMultiPartCoordinate(int32_t rotation, ModelCoordinate coord)
Adds rotationally dependent coordinates for this object part.
ExactModelCoordinate m_rotationAnchor
rotation anchor
bool isRestrictedRotation() const
Gets if object uses restricted rotations.
Object * m_inherited
pointer to inherited object
void setCost(double cost)
Sets the cost.
void removeMultiParts()
Removes all multi part objects.
int32_t m_zRange
z range value
Action * createAction(const std::string &identifier, bool is_default=false)
Adds new action with given id.
bool m_multiPart
indicates if object is part of multi object
const std::list< std::string > & getWalkableAreas() const
Returns a list that contains all walkable area ids.
std::string m_filename
filename
void addMultiPart(Object *obj)
Adds a object as a part of a multi object.
void addMultiPartId(const std::string &partId)
Adds a multi part identifier.
uint8_t m_cellStack
position on cellstack
IPather * m_pather
pointer to pathfinder
uint8_t getCellStackPosition() const
Returns cell stack position.
std::vector< ModelCoordinate > getMultiObjectCoordinates(int32_t rotation)
Returns all multi object coordinates for the given rotation.
Action * getAction(const std::string &identifier) const
Gets action with given id.
bool m_blocking
indicates if object blocks
int32_t getIndexByAngle(int32_t angle, const type_angle2id &angle2id, int32_t &closestMatchingAngle)
Returns id for given angle from angle2id map in case there are no elements in the map...
const std::string & getArea() const
Gets the area id that the instances of this object adds to their cells.
std::set< Object * > m_multiParts
set with part objects
bool isSpecialCost() const
Gets if object uses special cost.
bool operator==(const Object &obj) const
Compares equality of two objects.
Action * m_defaultAction
pointer to default action
bool m_static
indicates if object is static
void addWalkableArea(const std::string &id)
Adds an area id to walkable area.
int32_t getZStepRange() const
Returns z-step range from object.
type_angle2id m_multiAngleMap
multi object angles
void setPather(IPather *pather)
Sets pather used by instances created out of this object.
std::list< std::string > getActionIds() const
Gets all available action ids of the object and packs them into a list.
const ExactModelCoordinate & getRotationAnchor() const
Returns the rotation anchor for this multi object.
int32_t getRestrictedRotation(int32_t rotation)
Returns the most obvious rotation, based on multi coordinates.
bool isBlocking() const
Gets if object blocks movement.
void setCostId(const std::string &cost)
Sets the cost id.
std::map< std::string, Action * > * m_actions
holds action ids and assigned actions
IVisual * m_visual
pointer to object visual
std::string m_costId
cost identifier