MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / objectInScope

Method objectInScope

Engine/source/sim/netGhost.cpp:776–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776void NetConnection::objectInScope(NetObject *obj)
777{
778 if (!mScoping || !isGhostingFrom())
779 return;
780 if (obj->isScopeLocal() && !isLocalConnection())
781 return;
782
783 S32 index = obj->getId() & (GhostLookupTableSize - 1);
784
785 // check if it's already in scope
786 // the object may have been cleared out without the lookupTable being cleared
787 // so validate that the object pointers are the same.
788
789 for(GhostInfo *walk = mGhostLookupTable[index ]; walk; walk = walk->nextLookupInfo)
790 {
791 if(walk->obj != obj)
792 continue;
793 walk->flags |= GhostInfo::InScope;
794
795 // Make sure scope always if reflected on the ghostinfo too
796 if (obj->mNetFlags.test(NetObject::ScopeAlways))
797 walk->flags |= GhostInfo::ScopeAlways;
798
799 return;
800 }
801
802 if (mGhostFreeIndex == MaxGhostCount)
803 {
804 AssertWarn(0,"NetConnection::objectInScope: too many ghosts");
805 return;
806 }
807
808 GhostInfo *giptr = mGhostArray[mGhostFreeIndex];
809 ghostPushFreeToZero(giptr);
810 giptr->updateMask = 0xFFFFFFFF;
811 ghostPushNonZero(giptr);
812
813 giptr->flags = GhostInfo::NotYetGhosted | GhostInfo::InScope;
814
815 if(obj->mNetFlags.test(NetObject::ScopeAlways))
816 giptr->flags |= GhostInfo::ScopeAlways;
817
818 giptr->obj = obj;
819 giptr->updateChain = NULL;
820 giptr->updateSkipCount = 0;
821
822 giptr->connection = this;
823
824 giptr->nextObjectRef = obj->mFirstObjectRef;
825 if(obj->mFirstObjectRef)
826 obj->mFirstObjectRef->prevObjectRef = giptr;
827 giptr->prevObjectRef = NULL;
828 obj->mFirstObjectRef = giptr;
829
830 giptr->nextLookupInfo = mGhostLookupTable[index];
831 mGhostLookupTable[index] = giptr;
832 //AssertFatal(validateGhostArray(), "Invalid ghost array!");
833}

Callers 7

scopeCallbackFunction · 0.80
onCameraScopeQueryMethod · 0.80
_scopeCallbackFunction · 0.80
onCameraScopeQueryMethod · 0.80
setScopeAlwaysMethod · 0.80
onCameraScopeQueryMethod · 0.80
onCameraScopeQueryMethod · 0.80

Calls 3

isScopeLocalMethod · 0.80
getIdMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected