set the shape ID in the ctor's NOT the dtor

This commit is contained in:
Andrew Meadows 2014-07-31 13:08:27 -07:00
parent f579d2a0e2
commit 0b9f246661

View file

@ -32,8 +32,11 @@ public:
LIST_SHAPE LIST_SHAPE
}; };
Shape() : _type(UNKNOWN_SHAPE), _owningEntity(NULL), _boundingRadius(0.f), _translation(0.f), _rotation(), _mass(MAX_SHAPE_MASS) { } Shape() : _type(UNKNOWN_SHAPE), _owningEntity(NULL), _boundingRadius(0.f),
virtual ~Shape() { _id = getNextID(); } _translation(0.f), _rotation(), _mass(MAX_SHAPE_MASS) {
_id = getNextID();
}
virtual ~Shape() { }
int getType() const { return _type; } int getType() const { return _type; }
quint32 getID() const { return _id; } quint32 getID() const { return _id; }
@ -72,13 +75,19 @@ public:
protected: protected:
// these ctors are protected (used by derived classes only) // these ctors are protected (used by derived classes only)
Shape(Type type) : _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(0.f), _rotation() {} Shape(Type type) : _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(0.f), _rotation() {
_id = getNextID();
}
Shape(Type type, const glm::vec3& position) Shape(Type type, const glm::vec3& position)
: _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(position), _rotation() {} : _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(position), _rotation() {
_id = getNextID();
}
Shape(Type type, const glm::vec3& position, const glm::quat& rotation) Shape(Type type, const glm::vec3& position, const glm::quat& rotation)
: _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(position), _rotation(rotation) {} : _type(type), _owningEntity(NULL), _boundingRadius(0.f), _translation(position), _rotation(rotation) {
_id = getNextID();
}
void setBoundingRadius(float radius) { _boundingRadius = radius; } void setBoundingRadius(float radius) { _boundingRadius = radius; }