mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 09:25:31 +00:00
Fixed bug that could produce multiple script instances with equivalent instance IDs
This commit is contained in:
@@ -149,9 +149,9 @@ CScriptObject* CGameArea::InstanceByID(u32 InstanceID)
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
u32 CGameArea::FindUnusedInstanceID(CScriptLayer *pLayer) const
|
||||
u32 CGameArea::FindUnusedInstanceID() const
|
||||
{
|
||||
u32 InstanceID = (pLayer->AreaIndex() << 26) | (mWorldIndex << 16) | 1;
|
||||
u32 InstanceID = (mWorldIndex << 16) | 1;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ CScriptObject* CGameArea::SpawnInstance(CScriptTemplate *pTemplate,
|
||||
}
|
||||
|
||||
// Look for a valid instance ID
|
||||
InstanceID = FindUnusedInstanceID(pLayer);
|
||||
InstanceID = FindUnusedInstanceID();
|
||||
}
|
||||
|
||||
// Spawn instance
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
void ClearScriptLayers();
|
||||
u32 TotalInstanceCount() const;
|
||||
CScriptObject* InstanceByID(u32 InstanceID);
|
||||
u32 FindUnusedInstanceID(CScriptLayer *pLayer) const;
|
||||
u32 FindUnusedInstanceID() const;
|
||||
CScriptObject* SpawnInstance(CScriptTemplate *pTemplate, CScriptLayer *pLayer,
|
||||
const CVector3f& rkPosition = CVector3f::skZero,
|
||||
const CQuaternion& rkRotation = CQuaternion::skIdentity,
|
||||
|
||||
Reference in New Issue
Block a user