mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Basic zone code refactor using lists instead of linked lists
This commit is contained in:
parent
7e5eacc43d
commit
d9ff5d3f0e
8 changed files with 419 additions and 289 deletions
|
|
@ -128,8 +128,8 @@ SceneObject::SceneObject()
|
|||
|
||||
mSceneManager = NULL;
|
||||
|
||||
mZoneListHandle = 0;
|
||||
mNumCurrZones = 0;
|
||||
mZoneRefHead = NULL;
|
||||
mZoneRefDirty = false;
|
||||
|
||||
mLightPlugin = NULL;
|
||||
|
|
@ -168,7 +168,7 @@ SceneObject::~SceneObject()
|
|||
{
|
||||
AssertFatal(mContainer == NULL,
|
||||
"SceneObject::~SceneObject - Object still in container!");
|
||||
AssertFatal( mZoneRefHead == NULL,
|
||||
AssertFatal( mZoneListHandle == NULL,
|
||||
"SceneObject::~SceneObject - Object still linked in reference lists!");
|
||||
AssertFatal( !mSceneObjectLinks,
|
||||
"SceneObject::~SceneObject() - object is still linked to SceneTrackers" );
|
||||
|
|
@ -1024,7 +1024,7 @@ void SceneObject::unpackUpdate( NetConnection* conn, BitStream* stream )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void SceneObject::_updateZoningState() const
|
||||
void SceneObject::_updateZoningState()
|
||||
{
|
||||
if( mZoneRefDirty )
|
||||
{
|
||||
|
|
@ -1038,21 +1038,18 @@ void SceneObject::_updateZoningState() const
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
U32 SceneObject::getCurrZone( const U32 index ) const
|
||||
U32 SceneObject::getCurrZone( const U32 index )
|
||||
{
|
||||
SceneZoneSpaceManager* manager = getSceneManager()->getZoneManager();
|
||||
_updateZoningState();
|
||||
|
||||
// Not the most efficient way to do this, walking the list,
|
||||
// but it's an uncommon call...
|
||||
ZoneRef* walk = mZoneRefHead;
|
||||
for( U32 i = 0; i < index; ++ i )
|
||||
{
|
||||
walk = walk->nextInObj;
|
||||
AssertFatal( walk != NULL, "SceneObject::_getCurrZone - Too few object refs!" );
|
||||
}
|
||||
AssertFatal( walk != NULL, "SceneObject::_getCurrZone - Too few object refs!" );
|
||||
U32 numZones = 0;
|
||||
U32* zones = NULL;
|
||||
zones = manager->getZoneIDS(this, numZones);
|
||||
|
||||
return walk->zone;
|
||||
return index < numZones ? zones[index] : 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue