Skip to content

Commit

Permalink
- Updated LiquidFun physics plugin init sequence to be more consisten…
Browse files Browse the repository at this point in the history
…t with other modules
  • Loading branch information
iarwain committed Feb 21, 2025
1 parent d3573cf commit 7a1fe65
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions code/plugins/Physics/LiquidFun/orxPhysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3508,20 +3508,21 @@ extern "C" orxSTATUS orxFASTCALL orxPhysics_LiquidFun_Init()
/* Valid? */
if(pstClock != orxNULL)
{
/* Registers update function */
eResult = orxClock_Register(pstClock, orxPhysics_LiquidFun_Update, orxNULL, orxMODULE_ID_PHYSICS, orxCLOCK_PRIORITY_LOWER);
/* Creates event bank */
sstPhysics.pstEventBank = orxBank_Create(orxPhysics::su32MessageBankSize, sizeof(orxPHYSICS_EVENT_STORAGE), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN);

/* Valid? */
if(eResult != orxSTATUS_FAILURE)
{
/* Creates event bank */
sstPhysics.pstEventBank = orxBank_Create(orxPhysics::su32MessageBankSize, sizeof(orxPHYSICS_EVENT_STORAGE), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN);
/* Creates body bank */
sstPhysics.pstBodyBank = orxBank_Create(orxPhysics::su32BodyBankSize, sizeof(orxPHYSICS_BODY), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN);

/* Creates body bank */
sstPhysics.pstBodyBank = orxBank_Create(orxPhysics::su32BodyBankSize, sizeof(orxPHYSICS_BODY), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN);
/* Success? */
if((sstPhysics.pstEventBank != orxNULL)
&& (sstPhysics.pstBodyBank != orxNULL))
{
/* Registers update function */
eResult = orxClock_Register(pstClock, orxPhysics_LiquidFun_Update, orxNULL, orxMODULE_ID_PHYSICS, orxCLOCK_PRIORITY_LOWER);

if((sstPhysics.pstEventBank != orxNULL)
&& (sstPhysics.pstBodyBank != orxNULL))
/* Valid? */
if(eResult != orxSTATUS_FAILURE)
{
#ifdef orxPHYSICS_ENABLE_DEBUG_DRAW

Expand All @@ -3548,31 +3549,29 @@ extern "C" orxSTATUS orxFASTCALL orxPhysics_LiquidFun_Init()
}
else
{
if(sstPhysics.pstEventBank != orxNULL)
{
orxBank_Delete(sstPhysics.pstEventBank);
}

if(sstPhysics.pstBodyBank != orxNULL)
{
orxBank_Delete(sstPhysics.pstBodyBank);
}
/* Deletes banks */
orxBank_Delete(sstPhysics.pstEventBank);
orxBank_Delete(sstPhysics.pstBodyBank);

/* Deletes listeners */
delete sstPhysics.poContactListener;

/* Deletes world */
delete sstPhysics.poWorld;

/* Unregisters update function */
orxClock_Unregister(pstClock, orxPhysics_LiquidFun_Update);

/* Updates result */
eResult = orxSTATUS_FAILURE;
}
}
else
{
/* Deletes banks */
if(sstPhysics.pstEventBank != orxNULL)
{
orxBank_Delete(sstPhysics.pstEventBank);
}
if(sstPhysics.pstBodyBank != orxNULL)
{
orxBank_Delete(sstPhysics.pstBodyBank);
}

/* Deletes listeners */
delete sstPhysics.poContactListener;

Expand Down

0 comments on commit 7a1fe65

Please sign in to comment.