Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2009, 9:39:41 PM (15 years ago)
Author:
scheusso
Message:

-performance/memory optimisations in gamestate and synchronisable
-enhancement of portability (gcc↔msvc)

File:
1 edited

Legend:

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

    r2382 r2575  
    4646namespace packet {
    4747
     48#define GAMESTATE_START(data) (data + sizeof(GamestateHeader))
     49#define GAMESTATE_HEADER(data) ((GamestateHeader *)data)
     50#define HEADER GAMESTATE_HEADER(data_)
     51
    4852struct _NetworkExport GamestateHeader{
    4953  ENUM::Type packetType;
     
    5559  bool complete:1; // wheter it is a complete gamestate or only partial
    5660  bool compressed:1;
    57 #ifndef NDEBUG
    58   uint32_t crc32;
    59 #endif
    6061};
    6162
     
    7374    bool collectData(int id, uint8_t mode=0x0);
    7475    bool spreadData( uint8_t mode=0x0);
    75     int getID();
    76     bool isDiffed();
    77     bool isCompressed();
    78     int getBaseID();
     76    inline int32_t getID() const { return HEADER->id; }
     77    inline bool isDiffed() const { return HEADER->diffed; }
     78    inline bool isCompressed() const { return HEADER->compressed; }
     79    inline int32_t getBaseID() const { return HEADER->base_id; }
    7980    Gamestate *diff(Gamestate *base);
    80     Gamestate* intelligentDiff(Gamestate *base, unsigned int clientID);
    8181    Gamestate *undiff(Gamestate *base);
    82     Gamestate* intelligentUnDiff(Gamestate *base);
    8382    Gamestate* doSelection(unsigned int clientID, unsigned int targetSize);
    8483    bool compressData();
     
    8887  private:
    8988    virtual uint32_t getSize() const;
    90     virtual bool process();
     89    virtual inline bool process();
    9190
    9291    bool operator ==(packet::Gamestate gs);
    9392  private:
    9493    uint32_t calcGamestateSize(int32_t id, uint8_t mode=0x0);
    95     void removeObject(ObjectListIterator<Synchronisable> &it);
    9694    std::list<obj> dataMap_;
    97 //     static TrafficControl *trafficControl_;
    9895};
    9996
Note: See TracChangeset for help on using the changeset viewer.