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/Chat.cc

    r8858 r11006  
    4040/* Some lengths */
    4141#define _PACKETID         0
    42 #define _SOURCEID         _PACKETID + sizeof(Type::Value)
     42#define _SOURCEID         _PACKETID + sizeof(Type)
    4343#define _TARGETID         _SOURCEID + sizeof(uint32_t)
    4444#define _MESSAGELENGTH    _TARGETID + sizeof(uint32_t)
     
    5757  data_=new unsigned char[ getSize() ];
    5858
    59   *(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
     59  *(Type *)(data_ + _PACKETID ) = Type::Chat;
    6060  *(unsigned int *)(data_ + _SOURCEID ) = sourceID;
    6161  *(unsigned int *)(data_ + _TARGETID ) = targetID;
Note: See TracChangeset for help on using the changeset viewer.