Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2015, 11:34:25 PM (8 years ago)
Author:
landauf
Message:

made some enums in network library strongly typed. for most other enums in network this isn't possible because they are often used like flags (converted to int and compared with binary operators).
packet::Type now uses uint8_t as underlying type which reduces the network traffic (by default the type was int)

File:
1 edited

Legend:

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

    r10994 r11006  
    5656    GamestateHeader(){ data_=nullptr; }
    5757    GamestateHeader(uint8_t* data)
    58       { assert(data); data_ = data; *(uint32_t*)data_ = Type::Gamestate; }
     58      { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; }
    5959    /*GamestateHeader(uint8_t* data, GamestateHeader* h)
    6060      { assert(data); data_=data; memcpy(data_, h->data_, getSize()); }*/
    6161    void setData(uint8_t* data)
    62       { assert(data); data_ = data; *(uint32_t*)data_ = Type::Gamestate; }
     62      { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; }
    6363    static inline uint32_t getSize()
    6464      { return 21; }
Note: See TracChangeset for help on using the changeset viewer.