Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2010, 11:49:48 AM (14 years ago)
Author:
scheusso
Message:

changed diff behaviour in order to reduce datasize before and after compress
this reduces time needed for gamestate diff and compress about 50%

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network2/src/libraries/network/packet/Gamestate.h

    r6073 r6449  
    3636#include <cstring>
    3737#include <list>
     38#include <vector>
    3839
    3940#include "util/CRC32.h"
     
    113114    inline bool isCompressed() const { return header_->isCompressed(); }
    114115    inline int32_t getBaseID() const { return header_->getBaseID(); }
     116    inline uint32_t getDataSize() const { return header_->getDataSize(); }
    115117    Gamestate *diff(Gamestate *base);
    116     Gamestate *undiff(Gamestate *base);
    117118    Gamestate* doSelection(unsigned int clientID, unsigned int targetSize);
    118119    bool compressData();
     
    123124  private:
    124125    void rawDiff( uint8_t* newdata, uint8_t* data, uint8_t* basedata, uint32_t datalength, uint32_t baselength);
     126    inline uint32_t findObject( const SynchronisableHeader& header, uint8_t* mem, uint32_t dataLength, uint32_t startPosition = 0 );
    125127    virtual uint32_t getSize() const;
    126128    virtual inline bool process();
    127 
    128   private:
    129129    uint32_t calcGamestateSize(int32_t id, uint8_t mode=0x0);
    130     std::list<obj> dataVector_;
    131     GamestateHeader* header_;
     130   
     131    std::list<obj>          dataVector_;
     132    GamestateHeader*        header_;
     133    std::vector<uint32_t>   sizes_;
     134    uint32_t                nrOfVariables_;
    132135};
    133136
Note: See TracChangeset for help on using the changeset viewer.