mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
netObject classvar cleanups
This commit is contained in:
parent
ebf3f2d971
commit
386efa0602
|
|
@ -259,7 +259,7 @@ GameBase::GameBase()
|
|||
GameBase::~GameBase()
|
||||
{
|
||||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (scope_registered)
|
||||
if (mScope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ bool GameBase::onAdd()
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (isClientObject())
|
||||
{
|
||||
if (scope_id > 0 && !scope_registered)
|
||||
if (mScope_id > 0 && !mScope_registered)
|
||||
arcaneFX::registerScopedObject(this);
|
||||
}
|
||||
else
|
||||
|
|
@ -298,7 +298,7 @@ bool GameBase::onAdd()
|
|||
void GameBase::onRemove()
|
||||
{
|
||||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (scope_registered)
|
||||
if (mScope_registered)
|
||||
arcaneFX::unregisterScopedObject(this);
|
||||
#endif
|
||||
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
|
||||
|
|
@ -586,8 +586,8 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (stream->writeFlag(mask & ScopeIdMask))
|
||||
{
|
||||
if (stream->writeFlag(scope_refs > 0))
|
||||
stream->writeInt(scope_id, SCOPE_ID_BITS);
|
||||
if (stream->writeFlag(mScope_refs > 0))
|
||||
stream->writeInt(mScope_id, SCOPE_ID_BITS);
|
||||
}
|
||||
#endif
|
||||
return retMask;
|
||||
|
|
@ -631,8 +631,8 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
if (stream->readFlag())
|
||||
{
|
||||
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
|
||||
scope_refs = 0;
|
||||
mScope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
|
||||
mScope_refs = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,9 +331,9 @@ void afxChoreographer::unpack_constraint_info(NetConnection* conn, BitStream* st
|
|||
{
|
||||
if (stream->readFlag())
|
||||
{
|
||||
U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS);
|
||||
mScope_id = stream->readInt(NetObject::SCOPE_ID_BITS);
|
||||
bool is_shape = stream->readFlag();
|
||||
addObjectConstraint(scope_id, cons_name, is_shape);
|
||||
addObjectConstraint(mScope_id, cons_name, is_shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ NetObject::NetObject()
|
|||
mNextDirtyList = NULL;
|
||||
mDirtyMaskBits = 0;
|
||||
#ifdef TORQUE_AFX_ENABLED
|
||||
scope_id = 0;
|
||||
scope_refs = 0;
|
||||
scope_registered = false;
|
||||
mScope_id = 0;
|
||||
mScope_refs = 0;
|
||||
mScope_registered = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -478,23 +478,23 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),,
|
|||
#ifdef TORQUE_AFX_ENABLED
|
||||
U16 NetObject::addScopeRef()
|
||||
{
|
||||
if (scope_refs == 0)
|
||||
if (mScope_refs == 0)
|
||||
{
|
||||
scope_id = arcaneFX::generateScopeId();
|
||||
mScope_id = arcaneFX::generateScopeId();
|
||||
onScopeIdChange();
|
||||
}
|
||||
scope_refs++;
|
||||
return scope_id;
|
||||
mScope_refs++;
|
||||
return mScope_id;
|
||||
}
|
||||
|
||||
void NetObject::removeScopeRef()
|
||||
{
|
||||
if (scope_refs == 0)
|
||||
if (mScope_refs == 0)
|
||||
return;
|
||||
scope_refs--;
|
||||
if (scope_refs == 0)
|
||||
mScope_refs--;
|
||||
if (mScope_refs == 0)
|
||||
{
|
||||
scope_id = 0;
|
||||
mScope_id = 0;
|
||||
onScopeIdChange();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,17 +411,17 @@ public:
|
|||
|
||||
/// @}
|
||||
protected:
|
||||
U16 scope_id;
|
||||
U16 scope_refs;
|
||||
bool scope_registered;
|
||||
U16 mScope_id;
|
||||
U16 mScope_refs;
|
||||
bool mScope_registered;
|
||||
virtual void onScopeIdChange() { }
|
||||
public:
|
||||
enum { SCOPE_ID_BITS = 14 };
|
||||
U16 getScopeId() const { return scope_id; }
|
||||
U16 getScopeId() const { return mScope_id; }
|
||||
U16 addScopeRef();
|
||||
void removeScopeRef();
|
||||
void setScopeRegistered(bool flag) { scope_registered = flag; }
|
||||
bool getScopeRegistered() const { return scope_registered; }
|
||||
void setScopeRegistered(bool flag) { mScope_registered = flag; }
|
||||
bool getScopeRegistered() const { return mScope_registered; }
|
||||
|
||||
protected:
|
||||
/// Add a networked field
|
||||
|
|
|
|||
|
|
@ -515,11 +515,11 @@ void ScopeTracker< NUM_DIMENSIONS, Object >::updateObject( Object object )
|
|||
|
||||
while( !mPotentialScopeInObjects.empty() )
|
||||
{
|
||||
Object object = mPotentialScopeInObjects.last();
|
||||
Object obj = mPotentialScopeInObjects.last();
|
||||
mPotentialScopeInObjects.decrement();
|
||||
|
||||
if( Deref( object ).isInScope() )
|
||||
_onScopeIn( object );
|
||||
if( Deref(obj).isInScope() )
|
||||
_onScopeIn(obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue