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/Packet.h

    r8327 r11006  
    3838{
    3939
    40 namespace Direction
     40enum class Direction
    4141{
    42   enum Value
    43   {
    44     Incoming,
    45     Outgoing,
    46     Bidirectional
    47   };
    48 }
    49 namespace Type
     42  Incoming,
     43  Outgoing,
     44  Bidirectional
     45};
     46enum class Type : uint8_t
    5047{
    51   enum Value
    52   {
    53     Acknowledgement,
    54     Chat,
    55     ClassID,
    56     DeleteObjects,
    57     FunctionIDs,
    58     FunctionCalls,
    59     Gamestate,
    60     Welcome
    61   };
    62 }
     48  Acknowledgement,
     49  Chat,
     50  ClassID,
     51  DeleteObjects,
     52  FunctionIDs,
     53  FunctionCalls,
     54  Gamestate,
     55  Welcome
     56};
    6357
    6458/**
     
    9892    unsigned int peerID_;
    9993    uint32_t requiredGamestateID_;
    100     Direction::Value packetDirection_;
     94    Direction packetDirection_;
    10195    /** Pointer to the data. Be careful when deleting it because it might
    10296        point to a location that was allocated by ENet.
Note: See TracChangeset for help on using the changeset viewer.