| 101 | } |
| 102 | } |
| 103 | void unpack(NetConnection *ps, BitStream *bstream) |
| 104 | { |
| 105 | ghostIndex = bstream->readInt(NetConnection::GhostIdBitSize); |
| 106 | |
| 107 | if(bstream->readFlag()) |
| 108 | { |
| 109 | S32 classId = bstream->readClassId(NetClassTypeObject, ps->getNetClassGroup()); |
| 110 | if(classId == -1) |
| 111 | { |
| 112 | ps->setLastError("Invalid packet. (invalid ghost class id)"); |
| 113 | return; |
| 114 | } |
| 115 | object = (NetObject *) ConsoleObject::create(ps->getNetClassGroup(), NetClassTypeObject, classId); |
| 116 | if(!object) |
| 117 | { |
| 118 | ps->setLastError("Invalid packet. (failed to created from class id)"); |
| 119 | return; |
| 120 | } |
| 121 | object->mNetFlags = NetObject::IsGhost; |
| 122 | object->mNetIndex = ghostIndex; |
| 123 | |
| 124 | #ifdef TORQUE_NET_STATS |
| 125 | U32 beginSize = bstream->getBitPosition(); |
| 126 | #endif |
| 127 | object->unpackUpdate(ps, bstream); |
| 128 | #ifdef TORQUE_NET_STATS |
| 129 | object->getClassRep()->updateNetStatUnpack(bstream->getBitPosition() - beginSize); |
| 130 | #endif |
| 131 | validObject = true; |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | object = new NetObject; |
| 136 | validObject = false; |
| 137 | } |
| 138 | } |
| 139 | void process(NetConnection *ps) |
| 140 | { |
| 141 | Con::executef("onGhostAlwaysObjectReceived"); |
nothing calls this directly
no test coverage detected