Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1177 for code/branches


Ignore:
Timestamp:
Apr 24, 2008, 4:47:30 PM (17 years ago)
Author:
scheusso
Message:

bug fixed in packetdecoder (wrong copying)

Location:
code/branches/network3/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/GameStateClient.cc

    r1176 r1177  
    9797    while(data < state->data+state->size){
    9898      // prepare the syncData struct
    99       sync.length = (int)*data;
     99      sync.length = *(int *)data;
    100100      data+=sizeof(int);
    101       sync.objectID = (int)*data;
     101      sync.objectID = *(int*)data;
    102102      data+=sizeof(int);
    103       sync.classID = (int)*data;
     103      sync.classID = *(int*)data;
    104104      data+=sizeof(int);
    105105      sync.data = data;
  • code/branches/network3/src/network/PacketDecoder.cc

    r1168 r1177  
    161161    unsigned char* data = (unsigned char *)(packet->data);
    162162    //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));
    165163    memcpy( (void*)&(currentState->id), (const void*)(packet->data+1*sizeof( int )), sizeof( int) );
    166164    COUT(5) << "PacketDecoder: received gs id: " << currentState->id << std::endl;
    167 //     std::cout << "id: " << currentState->id << std::endl;
    168165    //copy the size of the GameStateCompressed compressed data into the new GameStateCompressed struct, located at 3th
    169166    //position of the data stream, data+2*sizeof( int )
    170167    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;
    173168    //size of uncompressed data
    174169    memcpy( (void*)&(currentState->normsize), (const void*)(packet->data+3*sizeof( int )), sizeof( int ) );
    175170    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;
    178171    //since the packetgenerator was changed, due to a new parameter, change this function too
    179172    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;
    182173    //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream
    183174    if(currentState->compsize==0)
     
    187178      COUT(2) << "PacketDecoder: Gamestatepacket-decoder: memory leak" << std::endl;
    188179    //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 );
    192181
    193182    //clean memory
  • code/branches/network3/src/network/Synchronisable.cc

    r1176 r1177  
    141141  syncData Synchronisable::getData(unsigned char *mem){
    142142    //std::cout << "inside getData" << std::endl;
     143    classID=this->getIdentifier()->getNetworkID();
    143144    std::list<synchronisableVariable *>::iterator i;
    144145    syncData retVal;
     
    146147    retVal.classID=this->classID;
    147148    retVal.length=getSize();
     149    COUT(4) << "Synchronisable getting data from objectID: " << retVal.objectID << " classID: " << retVal.classID << " length: " << retVal.length << std::endl;
    148150    retVal.data=mem;
    149151    // copy to location
Note: See TracChangeset for help on using the changeset viewer.