Changeset 1008 for code/branches/network/src/network/PacketDecoder.cc
- Timestamp:
- Apr 10, 2008, 12:55:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/PacketDecoder.cc
r986 r1008 52 52 { 53 53 int client = clientId; 54 COUT(5) << " clientId: " << client << std::endl; //control cout, not important, just debugging info54 COUT(5) << "PacketDecoder: clientId: " << client << std::endl; //control cout, not important, just debugging info 55 55 int id = (int)*packet->data; //the first 4 bytes are always the enet packet id 56 COUT(5) << "packet id: " << id << std::endl; 57 // COUT(5) << "packet size inside packetdecoder: " << packet->dataLength << std::endl; 56 COUT(5) << "PacketDecoder: packet id: " << id << std::endl; 57 //COUT(5) << "packet size inside packetdecoder: " << packet->dataLength << std::endl; 58 59 if ( packet == NULL ) { 60 COUT(4) << "PacketDecoder: no packets->packetbuffer queue is empty" << std::endl; 61 return false; 62 } 58 63 switch( id ) { 59 64 case ACK: … … 93 98 94 99 95 COUT(5) << " got ack id: " << a->id << std::endl;100 COUT(5) << "PacketDecoder: got ack id: " << a->id << std::endl; 96 101 processAck( a, clientId ); //debug info 97 102 … … 147 152 currentState = new GameStateCompressed; 148 153 if(currentState == NULL){ 149 COUT(3) << " could not generate new GameStateCompressed" << std::endl;154 COUT(3) << "PacketDecoder: could not generate new GameStateCompressed" << std::endl; 150 155 return; 151 156 } … … 156 161 //currentState->id = *((int *)packet->data+sizeof(int)); 157 162 memcpy( (void*)&(currentState->id), (const void*)(packet->data+1*sizeof( int )), sizeof( int) ); 158 COUT(5) << " decoder: received gs id: " << currentState->id << std::endl;163 COUT(5) << "PacketDecoder: received gs id: " << currentState->id << std::endl; 159 164 // std::cout << "id: " << currentState->id << std::endl; 160 165 //copy the size of the GameStateCompressed compressed data into the new GameStateCompressed struct, located at 3th … … 174 179 //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream 175 180 if(currentState->compsize==0) 176 COUT(2) << " compsize is 0" << std::endl;181 COUT(2) << "PacketDecoder: compsize is 0" << std::endl; 177 182 currentState->data = (unsigned char*)(malloc( currentState->compsize )); 178 183 if(currentState->data==NULL) 179 COUT(2) << " Gamestatepacket-decoder: memory leak" << std::endl;184 COUT(2) << "PacketDecoder: Gamestatepacket-decoder: memory leak" << std::endl; 180 185 //copy the GameStateCompressed data 181 186 //std::cout << "packet size (enet): " << packet->dataLength << std::endl; … … 197 202 void *data = (void *)cid->message; 198 203 memcpy(data, (const void*)(packet->data+3*sizeof(int)), cid->length); 199 COUT(4) << " classid: " << cid->clid << ", name: " << cid->message << std::endl;204 COUT(4) << "PacketDecoder: classid: " << cid->clid << ", name: " << cid->message << std::endl; 200 205 enet_packet_destroy( packet ); 201 206 processClassid(cid);
Note: See TracChangeset
for help on using the changeset viewer.