Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 986 for code/branches/network


Ignore:
Timestamp:
Apr 3, 2008, 3:10:16 PM (17 years ago)
Author:
scheusso
Message:

some changes in packetgenerator/decoder and gamestatemanager

Location:
code/branches/network/src/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/GameStateManager.cc

    r984 r986  
    132132      // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
    133133      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;
    137140      // increase data pointer
    138141      offset+=tempsize+3*sizeof(int);
     
    200203    r->size = dest_length;
    201204    r->diffed = true;
     205    r->base_id = a->id;
    202206    r->data = dp;
    203207    return r;
     
    232236    compressedGamestate->data = dest;
    233237    compressedGamestate->diffed = a->diffed;
     238    compressedGamestate->base_id = a->base_id;
    234239
    235240    return compressedGamestate;
  • code/branches/network/src/network/PacketDecoder.cc

    r984 r986  
    165165    //size of uncompressed data
    166166    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 ) );
    167168    //currentState->normsize = (int)*(data+3*sizeof(int));
    168169//     std::cout << "normsize. " << currentState->normsize << std::endl;
    169170    //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));
    171172    //currentState->diffed = (bool)*(data+4*sizeof(int));
    172173//     std::cout << "diffed: " << currentState->diffed << std::endl;
  • code/branches/network/src/network/PacketGenerator.cc

    r913 r986  
    113113    memcpy( (void*)(data+2*sizeof(int)), (const void*)&(states->compsize), sizeof(int));
    114114    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));
    124117    //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 );
    126119    //create an enet packet with the generated bytestream
    127120    ENetPacket *packet = enet_packet_create( data , totalLen, reliable );
  • code/branches/network/src/network/PacketTypes.h

    r790 r986  
    3737    int size;                       //!< total size of data
    3838    // new ---- change functions
     39    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
    3940    bool diffed;
    4041    unsigned char *data;            //!< pointer to data
     
    5253    int normsize;                   //!< size of uncompressed data
    5354    // new ----- change functions
     55    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
    5456    bool diffed;
    5557    unsigned char *data;            //!< gamestate data
Note: See TracChangeset for help on using the changeset viewer.