Skip to content

Commit

Permalink
UPBGE: Avoid unneeded dynamic_cast.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jun 30, 2018
1 parent c157a52 commit 06e4dd9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ void CcdPhysicsController::AddCompoundChild(PHY_IPhysicsController *child)
}
// other controller must be a bullet controller too
// verify that body and shape exist and match
CcdPhysicsController *childCtrl = dynamic_cast<CcdPhysicsController *>(child);
CcdPhysicsController *childCtrl = static_cast<CcdPhysicsController *>(child);
btRigidBody *rootBody = GetRigidBody();
btRigidBody *childBody = childCtrl->GetRigidBody();
if (!rootBody || !childBody) {
Expand Down Expand Up @@ -1569,7 +1569,7 @@ void CcdPhysicsController::RemoveCompoundChild(PHY_IPhysicsController *child)
}
// other controller must be a bullet controller too
// verify that body and shape exist and match
CcdPhysicsController *childCtrl = dynamic_cast<CcdPhysicsController *>(child);
CcdPhysicsController *childCtrl = static_cast<CcdPhysicsController *>(child);
btRigidBody *rootBody = GetRigidBody();
btRigidBody *childBody = childCtrl->GetRigidBody();
if (!rootBody || !childBody) {
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ btDispatcher *CcdPhysicsEnvironment::GetDispatcher()

void CcdPhysicsEnvironment::MergeEnvironment(PHY_IPhysicsEnvironment *other_env)
{
CcdPhysicsEnvironment *other = dynamic_cast<CcdPhysicsEnvironment *>(other_env);
CcdPhysicsEnvironment *other = static_cast<CcdPhysicsEnvironment *>(other_env);
if (other == nullptr) {
CM_Error("other scene is not using Bullet physics, not merging physics.");
return;
Expand Down Expand Up @@ -2189,7 +2189,7 @@ PHY_IVehicle *CcdPhysicsEnvironment::GetVehicleConstraint(int constraintId)
PHY_ICharacter *CcdPhysicsEnvironment::GetCharacterController(KX_GameObject *ob)
{
CcdPhysicsController *controller = (CcdPhysicsController *)ob->GetPhysicsController();
return (controller) ? dynamic_cast<CcdCharacter *>(controller->GetCharacterController()) : nullptr;
return (controller) ? static_cast<CcdCharacter *>(controller->GetCharacterController()) : nullptr;
}


Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Rasterizer/RAS_DisplayArrayBucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ void RAS_DisplayArrayBucket::RunBatchingNode(const RAS_DisplayArrayNodeTuple& tu
RAS_ManagerNodeData *managerData = tuple.m_managerData;
RAS_MaterialNodeData *materialData = tuple.m_materialData;

unsigned int nummeshslots = m_activeMeshSlots.size();
const unsigned int nummeshslots = m_activeMeshSlots.size();

// We must use a int instead of unsigned size to match GLsizei type.
std::vector<int> counts(nummeshslots);
std::vector<intptr_t> indices(nummeshslots);

RAS_BatchDisplayArray *batchArray = dynamic_cast<RAS_BatchDisplayArray *>(m_displayArray);
RAS_BatchDisplayArray *batchArray = static_cast<RAS_BatchDisplayArray *>(m_displayArray);

/* If the material use the transparency we must sort all mesh slots depending on the distance.
* This code share the code used in RAS_BucketManager to do the sort.
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Rasterizer/RAS_Rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,14 +1222,14 @@ RAS_ILightObject *RAS_Rasterizer::CreateLight()

void RAS_Rasterizer::AddLight(RAS_ILightObject *lightobject)
{
RAS_OpenGLLight *gllight = dynamic_cast<RAS_OpenGLLight *>(lightobject);
RAS_OpenGLLight *gllight = static_cast<RAS_OpenGLLight *>(lightobject);
BLI_assert(gllight);
m_lights.push_back(gllight);
}

void RAS_Rasterizer::RemoveLight(RAS_ILightObject *lightobject)
{
RAS_OpenGLLight *gllight = dynamic_cast<RAS_OpenGLLight *>(lightobject);
RAS_OpenGLLight *gllight = static_cast<RAS_OpenGLLight *>(lightobject);
BLI_assert(gllight);

CM_ListRemoveIfFound(m_lights, gllight);
Expand Down

0 comments on commit 06e4dd9

Please sign in to comment.