Skip to content

Commit 7d8718c

Browse files
committed
Fix custom model re-streaming issue (Fixes #2801)
1 parent c667e2a commit 7d8718c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Client/game_sa/CRenderWareSA.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ bool CRenderWareSA::ReplaceModel(RpClump* pNew, unsigned short usModelID, DWORD
362362
if (pModelInfo)
363363
{
364364
RpClump* pOldClump = (RpClump*)pModelInfo->GetRwObject();
365-
if (!DoContainTheSameGeometry(pNew, pOldClump, NULL))
365+
if (pOldClump != pNew && !DoContainTheSameGeometry(pNew, pOldClump, NULL))
366366
{
367367
if (pModelInfo->IsVehicle())
368368
{
@@ -392,11 +392,10 @@ bool CRenderWareSA::ReplaceModel(RpClump* pNew, unsigned short usModelID, DWORD
392392
CBaseModelInfoSAInterface* pModelInfoInterface = pModelInfo->GetInterface();
393393
CBaseModelInfo_SetClump(pModelInfoInterface, pNewClone);
394394
RpClumpDestroy(pOldClump);
395-
return true;
396395
}
397396
}
398397

399-
return false;
398+
return true;
400399
}
401400

402401
// Replaces a vehicle model
@@ -501,7 +500,7 @@ bool CRenderWareSA::ReplaceAllAtomicsInModel(RpClump* pNew, unsigned short usMod
501500
{
502501
RpAtomic* pOldAtomic = (RpAtomic*)pModelInfo->GetRwObject();
503502

504-
if (!DoContainTheSameGeometry(pNew, NULL, pOldAtomic))
503+
if (reinterpret_cast<RpClump*>(pOldAtomic) != pNew && !DoContainTheSameGeometry(pNew, NULL, pOldAtomic))
505504
{
506505
// Clone the clump that's to be replaced (FUNC_AtomicsReplacer removes the atomics from the source clump)
507506
RpClump* pCopy = RpClumpClone(pNew);
@@ -516,11 +515,10 @@ bool CRenderWareSA::ReplaceAllAtomicsInModel(RpClump* pNew, unsigned short usMod
516515

517516
// Get rid of the now empty copied clump
518517
RpClumpDestroy(pCopy);
519-
return true;
520518
}
521519
}
522520

523-
return false;
521+
return true;
524522
}
525523

526524
// Replaces all atomics in a vehicle

0 commit comments

Comments
 (0)