From d1d28e7becac809a9f130b6ad9480bc5e7477fe2 Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Tue, 21 Jun 2016 14:59:58 +0000 Subject: [PATCH] UPBGE: Replace m_bDyna by PHY_IPhysicsController::IsDynamic() in KX_GameObject. By removing m_bDynam we also remove the second argument of SetPhysicsConstroller. --- source/gameengine/Ketsji/KX_GameObject.cpp | 9 ++++++++- source/gameengine/Ketsji/KX_GameObject.h | 11 +++-------- source/gameengine/Ketsji/KX_Scene.cpp | 2 +- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 4db3c6a535ff..5bd6f8d72351 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -102,7 +102,6 @@ KX_GameObject::KX_GameObject( void* sgReplicationInfo, SG_Callbacks callbacks) : SCA_IObject(), - m_bDyna(false), m_layer(0), m_lodManager(NULL), m_currentLodLevel(0), @@ -629,6 +628,14 @@ CValue* KX_GameObject::GetReplica() return replica; } +bool KX_GameObject::IsDynamic() const +{ + if (m_pPhysicsController) { + return m_pPhysicsController->IsDynamic(); + } + return false; +} + bool KX_GameObject::IsDynamicsSuspended() const { if (m_pPhysicsController) diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 5bc694f30a38..78a0faebbc13 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -83,7 +83,6 @@ class KX_GameObject : public SCA_IObject Py_Header protected: - bool m_bDyna; KX_ClientObjectInfo* m_pClient_info; STR_String m_name; STR_String m_text; @@ -499,9 +498,8 @@ class KX_GameObject : public SCA_IObject PHY_IPhysicsController* GetPhysicsController(); - void SetPhysicsController(PHY_IPhysicsController* physicscontroller,bool isDynamic) + void SetPhysicsController(PHY_IPhysicsController *physicscontroller) { - m_bDyna = isDynamic; m_pPhysicsController = physicscontroller; } @@ -640,11 +638,8 @@ class KX_GameObject : public SCA_IObject m_pSGNode = node; } - //Is it a dynamic/physics object ? - bool IsDynamic() const - { - return m_bDyna; - } + /// Is it a dynamic/physics object ? + bool IsDynamic() const; bool IsDynamicsSuspended() const; diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 2fac67dca416..a29cf4afce3e 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -598,7 +598,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal PHY_IPhysicsController* parentctrl = (parent) ? parent->GetPhysicsController() : NULL; newctrl->SetNewClientInfo(newobj->getClientInfo()); - newobj->SetPhysicsController(newctrl, newobj->IsDynamic()); + newobj->SetPhysicsController(newctrl); newctrl->PostProcessReplica(motionstate, parentctrl); // Child objects must be static diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index d380c61ea5fd..ba476aa7dd9c 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -3325,7 +3325,7 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject *gameobj, RAS_MeshObject if (shapeInfo) shapeInfo->Release(); - gameobj->SetPhysicsController(physicscontroller, isbulletdyna); + gameobj->SetPhysicsController(physicscontroller); physicscontroller->SetNewClientInfo(gameobj->getClientInfo());