Changeset 986 for code/branches/network
- Timestamp:
- Apr 3, 2008, 3:10:16 PM (17 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/GameStateManager.cc
r984 r986 132 132 // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length) 133 133 sync=it->getData((retval->data)+offset+3*sizeof(int)); 134 *(retval->data+offset)=sync.length; 135 *(retval->data+offset+sizeof(int))=sync.objectID; 136 *(retval->data+offset+2*sizeof(int))=sync.classID; 134 memcpy(retval->data+offset, (void *)&sync.length, sizeof(int)); 135 //*(retval->data+offset)=sync.length; 136 memcpy(retval->data+offset+sizeof(int), (void *)&sync.objectID, sizeof(int)); 137 //*(retval->data+offset+sizeof(int))=sync.objectID; 138 memcpy(retval->data+offset+2*sizeof(int), (void *)&sync.classID, sizeof(int)); 139 //*(retval->data+offset+2*sizeof(int))=sync.classID; 137 140 // increase data pointer 138 141 offset+=tempsize+3*sizeof(int); … … 200 203 r->size = dest_length; 201 204 r->diffed = true; 205 r->base_id = a->id; 202 206 r->data = dp; 203 207 return r; … … 232 236 compressedGamestate->data = dest; 233 237 compressedGamestate->diffed = a->diffed; 238 compressedGamestate->base_id = a->base_id; 234 239 235 240 return compressedGamestate; -
code/branches/network/src/network/PacketDecoder.cc
r984 r986 165 165 //size of uncompressed data 166 166 memcpy( (void*)&(currentState->normsize), (const void*)(packet->data+3*sizeof( int )), sizeof( int ) ); 167 memcpy( (void*)&(currentState->base_id), (const void*)(packet->data+4*sizeof( int )), sizeof( int ) ); 167 168 //currentState->normsize = (int)*(data+3*sizeof(int)); 168 169 // std::cout << "normsize. " << currentState->normsize << std::endl; 169 170 //since the packetgenerator was changed, due to a new parameter, change this function too 170 memcpy( (void*)&(currentState->diffed), (const void*)(packet->data+ 4*sizeof(int)), sizeof(bool));171 memcpy( (void*)&(currentState->diffed), (const void*)(packet->data+5*sizeof(int)), sizeof(bool)); 171 172 //currentState->diffed = (bool)*(data+4*sizeof(int)); 172 173 // std::cout << "diffed: " << currentState->diffed << std::endl; -
code/branches/network/src/network/PacketGenerator.cc
r913 r986 113 113 memcpy( (void*)(data+2*sizeof(int)), (const void*)&(states->compsize), sizeof(int)); 114 114 memcpy( (void*)(data+3*sizeof(int)), (const void*)&(states->normsize), sizeof(int)); 115 memcpy( (void*)(data+4*sizeof(int)), (const void*)&(states->diffed), sizeof(bool)); 116 /*(int)*(data) = gid; 117 (int)*(data+sizeof(int)) = states->id; 118 //this is the compressed size of the GameStateCompressed data, place at 3th position of the enet datastream 119 (int)*(data+2*sizeof(int)) = states->compsize; 120 //this is the uncompressed size of GameStateCompressed data 121 (int)*(data+3*sizeof(int)) = states->normsize; 122 //since there is a new parameter inside GameStateCompressed, change this function to create packet 123 (bool)*(data+4*sizeof(int)) = states->diffed;*/ 115 memcpy( (void*)(data+4*sizeof(int)), (const void*)&(states->base_id), sizeof(int)); 116 memcpy( (void*)(data+5*sizeof(int)), (const void*)&(states->diffed), sizeof(bool)); 124 117 //place the GameStateCompressed data at the end of the enet datastream 125 memcpy( (void*)(data+ 4*sizeof( int ) + sizeof(bool)), (const void*)states->data, states->compsize );118 memcpy( (void*)(data+5*sizeof( int ) + sizeof(bool)), (const void*)states->data, states->compsize ); 126 119 //create an enet packet with the generated bytestream 127 120 ENetPacket *packet = enet_packet_create( data , totalLen, reliable ); -
code/branches/network/src/network/PacketTypes.h
r790 r986 37 37 int size; //!< total size of data 38 38 // new ---- change functions 39 int base_id; // if gamestate is diffed this is the id of the old gamestate (base) 39 40 bool diffed; 40 41 unsigned char *data; //!< pointer to data … … 52 53 int normsize; //!< size of uncompressed data 53 54 // new ----- change functions 55 int base_id; // if gamestate is diffed this is the id of the old gamestate (base) 54 56 bool diffed; 55 57 unsigned char *data; //!< gamestate data
Note: See TracChangeset
for help on using the changeset viewer.