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

Method unpack

Engine/source/T3D/fx/lightning.cpp:199–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void LightningStrikeEvent::unpack(NetConnection* con, BitStream* stream)
200{
201 if(!stream->readFlag())
202 return;
203 mClientId = stream->readRangedU32(0, NetConnection::MaxGhostCount);
204 mLightning = NULL;
205 NetObject* pObject = con->resolveGhost(mClientId);
206 if (pObject)
207 mLightning = dynamic_cast<Lightning*>(pObject);
208
209 mStart.x = stream->readFloat(PositionalBits);
210 mStart.y = stream->readFloat(PositionalBits);
211
212 if( stream->readFlag() )
213 {
214 // target id
215 S32 mTargetID = stream->readRangedU32(0, NetConnection::MaxGhostCount);
216
217 NetObject* tObject = con->resolveGhost(mTargetID);
218 if(tObject != NULL )
219 {
220 mTarget = dynamic_cast<SceneObject*>(tObject);
221 }
222 if( bool(mTarget) == false )
223 {
224 Con::errorf(ConsoleLogEntry::General, "LightningStrikeEvent::unpack: could not resolve target ghost properly");
225 }
226 }
227}
228
229void LightningStrikeEvent::process(NetConnection*)
230{

Callers 3

unpackUpdateMethod · 0.45
unpackUpdateMethod · 0.45
unpackUpdateMethod · 0.45

Calls 5

readFlagMethod · 0.80
readRangedU32Method · 0.80
resolveGhostMethod · 0.80
readFloatMethod · 0.80
errorfFunction · 0.50

Tested by

no test coverage detected