Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2007, 1:46:03 PM (16 years ago)
Author:
dumenim
Message:

changed PacketGenerator/Decoder with diffed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/PacketGenerator.cc

    r415 r437  
    2222ENetPacket* PacketGenerator::acknowledgement( int state, int reliable )
    2323{
    24         std::cout << "generating new acknowledgement" << std::endl;
     24    std::cout << "generating new acknowledgement" << std::endl;
    2525        ack* ackreq = new ack;
    2626        ackreq->id = ACK;
     
    7373        int* gid = new int;
    7474        *gid = GAMESTATE; //first assign the correct enet id
    75         int totalLen = 3*sizeof( int ) + states->compsize; //calculate the total size of the datastream memory
     75        int totalLen = 4*sizeof( int ) + sizeof(bool) + states->compsize; //calculate the total size of the datastream memory
    7676        unsigned char* data = (unsigned char*)malloc( totalLen ); //allocate the memory for datastream
    7777        memcpy( (void*)(data), (const void*)gid, sizeof( int ) ); //this is the enet id
     
    8181        //this is the uncompressed size of GameStateCompressed data
    8282        memcpy( (void*)(data+3*sizeof(int)), (const void*)&(states->normsize), sizeof(int));
     83        //since there is a new parameter inside GameStateCompressed, change this function to create packet
     84        memcpy( (void*)(data+4*sizeof(int)), (const void*)states->diffed, sizeof(bool));
    8385        //place the GameStateCompressed data at the end of the enet datastream
    84         memcpy( (void*)(data+4*sizeof( int )), (const void*)states->data, states->compsize );
     86        memcpy( (void*)(data+4*sizeof( int ) + sizeof(bool)), (const void*)states->data, states->compsize );
    8587        //create an enet packet with the generated bytestream
    8688        ENetPacket *packet = enet_packet_create( data , totalLen, reliable );
Note: See TracChangeset for help on using the changeset viewer.