| 197 | } |
| 198 | |
| 199 | void 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 | |
| 229 | void LightningStrikeEvent::process(NetConnection*) |
| 230 | { |
no test coverage detected