void SimDataBlockEvent::notifyDelivered(NetConnection *conn, bool ) { // if the modified key for this event is not the current one, // we've already resorted and resent some blocks, so fall out. if(conn->isRemoved()) return; GameConnection *gc = (GameConnection *) conn; if(gc->getDataBlockSequence() != mMissionSequence) return; U32 nextIndex = mIndex + DataBlockQueueCount; SimDataBlockGroup *g = Sim::getDataBlockGroup(); if(mIndex == g->size() - 1) { gc->setDataBlockModifiedKey(gc->getMaxDataBlockModifiedKey()); gc->sendConnectionMessage(GameConnection::DataBlocksDone, mMissionSequence); } if(g->size() <= nextIndex) return; SimDataBlock *blk = (SimDataBlock *) (*g)[nextIndex]; gc->postNetEvent(new SimDataBlockEvent(blk, nextIndex, g->size(), mMissionSequence)); }
void SimDataBlockEvent::pack(NetConnection *conn, BitStream *bstream) { #ifdef AFX_CAP_DATABLOCK_CACHE // AFX CODE BLOCK (db-cache) << ((GameConnection *)conn)->tempDisableStringBuffering(bstream); #endif // AFX CODE BLOCK (db-cache) >> SimDataBlock* obj; Sim::findObject(id,obj); GameConnection *gc = (GameConnection *) conn; if(bstream->writeFlag(gc->getDataBlockModifiedKey() < obj->getModifiedKey())) { if(obj->getModifiedKey() > gc->getMaxDataBlockModifiedKey()) gc->setMaxDataBlockModifiedKey(obj->getModifiedKey()); AssertFatal(obj, "SimDataBlockEvent:: Data blocks cannot be deleted"); bstream->writeInt(id - DataBlockObjectIdFirst,DataBlockObjectIdBitSize); S32 classId = obj->getClassId(conn->getNetClassGroup()); bstream->writeClassId(classId, NetClassTypeDataBlock, conn->getNetClassGroup()); bstream->writeInt(mIndex, DataBlockObjectIdBitSize); bstream->writeInt(mTotal, DataBlockObjectIdBitSize + 1); obj->packData(bstream); #ifdef TORQUE_DEBUG_NET bstream->writeInt(classId ^ DebugChecksum, 32); #endif } #ifdef AFX_CAP_DATABLOCK_CACHE // AFX CODE BLOCK (db-cache) << ((GameConnection *)conn)->restoreStringBuffering(bstream); #endif // AFX CODE BLOCK (db-cache) >> }
void SimDataBlockEvent::pack(NetConnection *conn, BitStream *bstream) { SimDataBlock* obj; Sim::findObject(id,obj); GameConnection *gc = (GameConnection *) conn; if(bstream->writeFlag(gc->getDataBlockModifiedKey() < obj->getModifiedKey())) { if(obj->getModifiedKey() > gc->getMaxDataBlockModifiedKey()) gc->setMaxDataBlockModifiedKey(obj->getModifiedKey()); AssertFatal(obj, "SimDataBlockEvent:: Data blocks cannot be deleted"); bstream->writeInt(id - DataBlockObjectIdFirst,DataBlockObjectIdBitSize); S32 classId = obj->getClassId(conn->getNetClassGroup()); bstream->writeClassId(classId, NetClassTypeDataBlock, conn->getNetClassGroup()); bstream->writeInt(mIndex, DataBlockObjectIdBitSize); bstream->writeInt(mTotal, DataBlockObjectIdBitSize + 1); obj->packData(bstream); #ifdef TORQUE_DEBUG_NET bstream->writeInt(classId ^ DebugChecksum, 32); #endif } }