Changeset 1177 for code/branches/network3/src/network
- Timestamp:
- Apr 24, 2008, 4:47:30 PM (17 years ago)
- Location:
- code/branches/network3/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/network/GameStateClient.cc
r1176 r1177 97 97 while(data < state->data+state->size){ 98 98 // prepare the syncData struct 99 sync.length = (int)*data;99 sync.length = *(int *)data; 100 100 data+=sizeof(int); 101 sync.objectID = (int)*data;101 sync.objectID = *(int*)data; 102 102 data+=sizeof(int); 103 sync.classID = (int)*data;103 sync.classID = *(int*)data; 104 104 data+=sizeof(int); 105 105 sync.data = data; -
code/branches/network3/src/network/PacketDecoder.cc
r1168 r1177 161 161 unsigned char* data = (unsigned char *)(packet->data); 162 162 //copy the GameStateCompressed id into the struct, which is located at second place data+sizeof( int ) 163 //memcpy( (void*)&(currentState->id), (const void*)(data+sizeof( int )), sizeof( int ) );164 //currentState->id = *((int *)packet->data+sizeof(int));165 163 memcpy( (void*)&(currentState->id), (const void*)(packet->data+1*sizeof( int )), sizeof( int) ); 166 164 COUT(5) << "PacketDecoder: received gs id: " << currentState->id << std::endl; 167 // std::cout << "id: " << currentState->id << std::endl;168 165 //copy the size of the GameStateCompressed compressed data into the new GameStateCompressed struct, located at 3th 169 166 //position of the data stream, data+2*sizeof( int ) 170 167 memcpy( (void*)&(currentState->compsize), (const void*)(packet->data+2*sizeof( int )), sizeof( int) ); 171 //currentState->compsize = (int)*(data+2*sizeof(int));172 // std::cout << "compsize: " << currentState->compsize << std::endl;173 168 //size of uncompressed data 174 169 memcpy( (void*)&(currentState->normsize), (const void*)(packet->data+3*sizeof( int )), sizeof( int ) ); 175 170 memcpy( (void*)&(currentState->base_id), (const void*)(packet->data+4*sizeof( int )), sizeof( int ) ); 176 //currentState->normsize = (int)*(data+3*sizeof(int));177 // std::cout << "normsize. " << currentState->normsize << std::endl;178 171 //since the packetgenerator was changed, due to a new parameter, change this function too 179 172 memcpy( (void*)&(currentState->diffed), (const void*)(packet->data+5*sizeof(int)), sizeof(bool)); 180 //currentState->diffed = (bool)*(data+4*sizeof(int));181 // std::cout << "diffed: " << currentState->diffed << std::endl;182 173 //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream 183 174 if(currentState->compsize==0) … … 187 178 COUT(2) << "PacketDecoder: Gamestatepacket-decoder: memory leak" << std::endl; 188 179 //copy the GameStateCompressed data 189 //std::cout << "packet size (enet): " << packet->dataLength << std::endl; 190 //std::cout << "totallen: " << 4*sizeof(int)+sizeof(bool)+currentState->compsize << std::endl; 191 memcpy( (void*)(currentState->data), (const void*)(packet->data+4*sizeof( int ) + sizeof(bool)), currentState->compsize ); 180 memcpy( (void*)(currentState->data), (const void*)(packet->data+5*sizeof( int ) + sizeof(bool)), currentState->compsize ); 192 181 193 182 //clean memory -
code/branches/network3/src/network/Synchronisable.cc
r1176 r1177 141 141 syncData Synchronisable::getData(unsigned char *mem){ 142 142 //std::cout << "inside getData" << std::endl; 143 classID=this->getIdentifier()->getNetworkID(); 143 144 std::list<synchronisableVariable *>::iterator i; 144 145 syncData retVal; … … 146 147 retVal.classID=this->classID; 147 148 retVal.length=getSize(); 149 COUT(4) << "Synchronisable getting data from objectID: " << retVal.objectID << " classID: " << retVal.classID << " length: " << retVal.length << std::endl; 148 150 retVal.data=mem; 149 151 // copy to location
Note: See TracChangeset
for help on using the changeset viewer.