Skip to content

Commit

Permalink
UPBGE: Replace m_bDyna by PHY_IPhysicsController::IsDynamic() in KX_G…
Browse files Browse the repository at this point in the history
…ameObject.

By removing m_bDynam we also remove the second argument of SetPhysicsConstroller.
  • Loading branch information
panzergame committed Jun 21, 2016
1 parent 96517f7 commit d1d28e7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
9 changes: 8 additions & 1 deletion source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 3 additions & 8 deletions source/gameengine/Ketsji/KX_GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Ketsji/KX_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit d1d28e7

Please sign in to comment.