Changeset 2485 for code/branches/presentation/src/network/packet
- Timestamp:
- Dec 16, 2008, 6:01:13 PM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
-
code/branches/presentation/src/network/packet/Acknowledgement.h
r2171 r2485 32 32 #include "Packet.h" 33 33 34 const unsigned int ACKID_NACK = 0; 34 35 35 36 namespace orxonox { -
code/branches/presentation/src/network/packet/Gamestate.cc
r2476 r2485 31 31 #include "../synchronisable/Synchronisable.h" 32 32 #include "../TrafficControl.h" 33 #include "core/Core.h" 33 34 #include "core/CoreIncludes.h" 34 35 #include "core/Iterator.h" … … 151 152 if(!s) 152 153 { 153 Synchronisable::fabricate(mem, mode); 154 if (!Core::isMaster()) 155 Synchronisable::fabricate(mem, mode); 156 else 157 mem += objectheader->size; 154 158 // COUT(0) << "could not fabricate synchronisable: " << objectheader->objectID << " classid: " << objectheader->classID << " creator: " << objectheader->creatorID << endl; 155 159 // else … … 170 174 if (it->objectMode_ != 0x0) { 171 175 COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl; 176 COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl; 172 177 assert(false); 173 178 } … … 384 389 //call TrafficControl 385 390 TrafficControl::getInstance()->processObjectList( clientID, HEADER->id, &dataMap_ ); 386 391 387 392 //copy in the zeros 388 393 for(it=dataMap_.begin(); it!=dataMap_.end();){ 389 394 // if((*it).objSize==0) 390 395 // continue; 396 // if(it->second->getSize(HEADER->id)==0) // merged from objecthierarchy2, doesn't work anymore; TODO: change this 397 // continue; // merged from objecthierarchy2, doesn't work anymore; TODO: change this 391 398 oldobjectheader = (synchronisableHeader*)origdata; 392 399 newobjectheader = (synchronisableHeader*)newdata; -
code/branches/presentation/src/network/packet/Packet.cc
r2171 r2485 129 129 return false; 130 130 } 131 // Assures we don't create a packet and destroy it right after in another thread132 // without having a reference in the packetMap_133 boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);134 131 // We deliver ENet the data address so that it doesn't memcpy everything again. 135 132 // --> We have to delete data_ ourselves! … … 138 135 // Add the packet to a global list so we can access it again once enet calls our 139 136 // deletePacket method. We can of course only give a one argument function to the ENet C library. 140 packetMap_[(size_t)(void*)enetPacket_] = this; 137 { 138 // Assures we don't create a packet and destroy it right after in another thread 139 // without having a reference in the packetMap_ 140 boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex); 141 packetMap_[(size_t)(void*)enetPacket_] = this; 142 } 141 143 } 142 144 #ifndef NDEBUG -
code/branches/presentation/src/network/packet/Welcome.cc
r2483 r2485 43 43 #define _CLIENTID _PACKETID + sizeof(ENUM::Type) 44 44 #define _ENDIANTEST _CLIENTID + sizeof(uint32_t) 45 45 46 46 Welcome::Welcome( uint32_t clientID, uint32_t shipID ) 47 47 : Packet() … … 74 74 75 75 bool Welcome::process(){ 76 uint32_t shipID,clientID;76 uint32_t clientID; 77 77 clientID = *(uint32_t *)(data_ + _CLIENTID ); 78 78 assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
Note: See TracChangeset
for help on using the changeset viewer.