Skip to content

Commit

Permalink
Fix Visual Studio crashes related to nans and uninitialized variables.
Browse files Browse the repository at this point in the history
Specifically, this fixes a crash when exploding the gas tank in the
inner yard in Chapter 5.
  • Loading branch information
rohit-n authored and Katana-Steel committed Feb 12, 2024
1 parent b6a4061 commit a8cf3dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NOLF2/ClientShellDLL/ClientShellShared/ExplosionFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ LTBOOL CExplosionFX::CreateObject(ILTClient *pClientDE)

// Determine what container we're in...

ContainerCode eCode;
ContainerCode eCode = CC_NO_CONTAINER;
HLOCALOBJ objList[1];
LTVector vTestPos = m_cs.vPos;
uint32 dwNum = ::GetPointContainers(vTestPos, objList, 1, ::GetLiquidFlags());
Expand Down
6 changes: 6 additions & 0 deletions NOLF2/ClientShellDLL/ClientShellShared/SFXMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ void CSFXMgr::HandleSFXMsg(HLOCALOBJ hObj, ILTMessage_Read *pMsg)
debris.vPos = pMsg->ReadCompPos();
debris.nDebrisId = pMsg->Readuint8();

if (std::isnan(debris.rRot[0]) || std::isnan(debris.rRot[1]) ||
std::isnan(debris.rRot[2]) || std::isnan(debris.rRot[3]))
{
debris.rRot.Identity();
}

CreateSFX(nId, &debris);
}
break;
Expand Down

0 comments on commit a8cf3dd

Please sign in to comment.