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

Method packUpdate

Engine/source/Verve/VPath/VPathObject.cpp:80–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78//-----------------------------------------------------------------------------
79
80U32 VPathObject::packUpdate( NetConnection *pConnection, BitStream *pStream )
81{
82 // Init Return Mask.
83 U32 retMask = 0;
84
85 // Fetch State.
86 VNetStateInfo *state = getState( pConnection );
87
88 // Write Active.
89 pStream->writeFlag( mActive );
90
91 // Send Object Update?
92 if ( pStream->writeFlag( state->Mask & k_StateUpdateObject ) )
93 {
94 // Successful Send?
95 bool success = false;
96
97 // Valid Object?
98 if ( !mObject )
99 {
100 // No Object.
101 pStream->writeFlag( false );
102 }
103 else
104 {
105 // Write Ghost Index.
106 const S32 ghostIndex = pConnection->getGhostIndex( mObject );
107 if ( pStream->writeFlag( ghostIndex != -1 ) )
108 {
109 // Write Ghost Id.
110 pStream->writeInt( ghostIndex, NetConnection::GhostIdBitSize );
111
112 // Success!
113 success = true;
114 // Clear Update.
115 state->Mask &= ~k_StateUpdateObject;
116 }
117 }
118
119 if ( !success )
120 {
121 // Try Again Later.
122 retMask |= VPath::ObjectUpdateMask;
123 }
124 }
125
126 // Send Mount Update?
127 if ( pStream->writeFlag( state->Mask & k_StateUpdateMount ) )
128 {
129 // Successful Send?
130 bool success = false;
131
132 // Valid Objects?
133 if ( !mObject || !mObject->getObjectMount() || ( state->Mask & k_StateUpdateObject ) )
134 {
135 // No Object.
136 pStream->writeFlag( false );
137 }

Callers

nothing calls this directly

Calls 7

getStateFunction · 0.85
getGhostIndexMethod · 0.80
writeIntMethod · 0.80
getObjectMountMethod · 0.80
getMountNodeMethod · 0.80
writeFlagMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected