mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
some ObjectAction methods should be const
This commit is contained in:
parent
30dd9728eb
commit
77bd7b2821
11 changed files with 20 additions and 21 deletions
|
@ -28,7 +28,7 @@ void AssignmentAction::removeFromSimulation(EntitySimulation* simulation) const
|
|||
simulation->removeAction(_id);
|
||||
}
|
||||
|
||||
QByteArray AssignmentAction::serialize() {
|
||||
QByteArray AssignmentAction::serialize() const {
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,14 +25,14 @@ public:
|
|||
virtual ~AssignmentAction();
|
||||
|
||||
const QUuid& getID() const { return _id; }
|
||||
virtual EntityActionType getType() { return _type; }
|
||||
virtual EntityActionType getType() const { return _type; }
|
||||
virtual void removeFromSimulation(EntitySimulation* simulation) const;
|
||||
virtual EntityItemWeakPointer getOwnerEntity() const { return _ownerEntity; }
|
||||
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) { _ownerEntity = ownerEntity; }
|
||||
virtual bool updateArguments(QVariantMap arguments);
|
||||
virtual QVariantMap getArguments();
|
||||
|
||||
virtual QByteArray serialize();
|
||||
virtual QByteArray serialize() const;
|
||||
virtual void deserialize(QByteArray serializedArguments);
|
||||
|
||||
private:
|
||||
|
|
|
@ -166,8 +166,7 @@ QVariantMap AvatarActionHold::getArguments() {
|
|||
|
||||
|
||||
void AvatarActionHold::deserialize(QByteArray serializedArguments) {
|
||||
if (_mine) {
|
||||
return;
|
||||
if (!_mine) {
|
||||
ObjectActionSpring::deserialize(serializedArguments);
|
||||
}
|
||||
ObjectActionSpring::deserialize(serializedArguments);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
AvatarActionHold(EntityActionType type, QUuid id, EntityItemPointer ownerEntity);
|
||||
virtual ~AvatarActionHold();
|
||||
|
||||
virtual EntityActionType getType() { return ACTION_TYPE_HOLD; }
|
||||
virtual EntityActionType getType() const { return ACTION_TYPE_HOLD; }
|
||||
|
||||
virtual bool updateArguments(QVariantMap arguments);
|
||||
virtual QVariantMap getArguments();
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
EntityActionInterface() { }
|
||||
virtual ~EntityActionInterface() { }
|
||||
virtual const QUuid& getID() const = 0;
|
||||
virtual EntityActionType getType() { assert(false); return ACTION_TYPE_NONE; }
|
||||
virtual EntityActionType getType() const { assert(false); return ACTION_TYPE_NONE; }
|
||||
|
||||
virtual void removeFromSimulation(EntitySimulation* simulation) const = 0;
|
||||
virtual EntityItemWeakPointer getOwnerEntity() const = 0;
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
virtual bool updateArguments(QVariantMap arguments) = 0;
|
||||
virtual QVariantMap getArguments() = 0;
|
||||
|
||||
virtual QByteArray serialize() = 0;
|
||||
virtual QByteArray serialize() const = 0;
|
||||
virtual void deserialize(QByteArray serializedArguments) = 0;
|
||||
|
||||
static EntityActionType actionTypeFromString(QString actionTypeString);
|
||||
|
|
|
@ -24,15 +24,15 @@ ObjectAction::~ObjectAction() {
|
|||
}
|
||||
|
||||
void ObjectAction::updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep) {
|
||||
if (!_active) {
|
||||
return;
|
||||
}
|
||||
if (_ownerEntity.expired()) {
|
||||
qDebug() << "warning -- action with no entity removing self from btCollisionWorld.";
|
||||
btDynamicsWorld* dynamicsWorld = static_cast<btDynamicsWorld*>(collisionWorld);
|
||||
dynamicsWorld->removeAction(this);
|
||||
return;
|
||||
}
|
||||
if (!_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateActionWorker(deltaTimeStep);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void ObjectAction::setAngularVelocity(glm::vec3 angularVelocity) {
|
|||
rigidBody->activate();
|
||||
}
|
||||
|
||||
QByteArray ObjectAction::serialize() {
|
||||
QByteArray ObjectAction::serialize() const {
|
||||
assert(false);
|
||||
return QByteArray();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
virtual ~ObjectAction();
|
||||
|
||||
const QUuid& getID() const { return _id; }
|
||||
virtual EntityActionType getType() { assert(false); return ACTION_TYPE_NONE; }
|
||||
virtual EntityActionType getType() const { assert(false); return ACTION_TYPE_NONE; }
|
||||
virtual void removeFromSimulation(EntitySimulation* simulation) const;
|
||||
virtual EntityItemWeakPointer getOwnerEntity() const { return _ownerEntity; }
|
||||
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) { _ownerEntity = ownerEntity; }
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
virtual void updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep);
|
||||
virtual void debugDraw(btIDebugDraw* debugDrawer);
|
||||
|
||||
virtual QByteArray serialize();
|
||||
virtual QByteArray serialize() const;
|
||||
virtual void deserialize(QByteArray serializedArguments);
|
||||
|
||||
private:
|
||||
|
|
|
@ -127,7 +127,7 @@ QVariantMap ObjectActionOffset::getArguments() {
|
|||
return arguments;
|
||||
}
|
||||
|
||||
QByteArray ObjectActionOffset::serialize() {
|
||||
QByteArray ObjectActionOffset::serialize() const {
|
||||
QByteArray ba;
|
||||
QDataStream dataStream(&ba, QIODevice::WriteOnly);
|
||||
dataStream << getType();
|
||||
|
|
|
@ -22,14 +22,14 @@ public:
|
|||
ObjectActionOffset(EntityActionType type, QUuid id, EntityItemPointer ownerEntity);
|
||||
virtual ~ObjectActionOffset();
|
||||
|
||||
virtual EntityActionType getType() { return ACTION_TYPE_OFFSET; }
|
||||
virtual EntityActionType getType() const { return ACTION_TYPE_OFFSET; }
|
||||
|
||||
virtual bool updateArguments(QVariantMap arguments);
|
||||
virtual QVariantMap getArguments();
|
||||
|
||||
virtual void updateActionWorker(float deltaTimeStep);
|
||||
|
||||
virtual QByteArray serialize();
|
||||
virtual QByteArray serialize() const;
|
||||
virtual void deserialize(QByteArray serializedArguments);
|
||||
|
||||
private:
|
||||
|
|
|
@ -206,7 +206,7 @@ QVariantMap ObjectActionSpring::getArguments() {
|
|||
return arguments;
|
||||
}
|
||||
|
||||
QByteArray ObjectActionSpring::serialize() {
|
||||
QByteArray ObjectActionSpring::serialize() const {
|
||||
QByteArray serializedActionArguments;
|
||||
QDataStream dataStream(&serializedActionArguments, QIODevice::WriteOnly);
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@ public:
|
|||
ObjectActionSpring(EntityActionType type, QUuid id, EntityItemPointer ownerEntity);
|
||||
virtual ~ObjectActionSpring();
|
||||
|
||||
virtual EntityActionType getType() { return ACTION_TYPE_SPRING; }
|
||||
virtual EntityActionType getType() const { return ACTION_TYPE_SPRING; }
|
||||
|
||||
virtual bool updateArguments(QVariantMap arguments);
|
||||
virtual QVariantMap getArguments();
|
||||
|
||||
virtual void updateActionWorker(float deltaTimeStep);
|
||||
|
||||
virtual QByteArray serialize();
|
||||
virtual QByteArray serialize() const;
|
||||
virtual void deserialize(QByteArray serializedArguments);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue