Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2015, 11:34:25 PM (9 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/DeleteObjects.cc

    r8858 r11006  
    3939#define PACKET_FLAG_DELETE  PacketFlag::Reliable
    4040#define _PACKETID           0
    41 #define _QUANTITY           _PACKETID + sizeof(Type::Value)
     41#define _QUANTITY           _PACKETID + sizeof(Type)
    4242#define _OBJECTIDS          _QUANTITY + sizeof(uint32_t)
    4343
     
    6363    return false;
    6464  orxout(verbose, context::packets) << "sending DeleteObjects: ";
    65   unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1);
     65  unsigned int size = sizeof(Type) + sizeof(uint32_t)*(number+1);
    6666  data_ = new uint8_t[size];
    6767  uint8_t *tdata = data_;
    68   *reinterpret_cast<Type::Value*>(tdata) = Type::DeleteObjects;
    69   tdata += sizeof(Type::Value);
     68  *reinterpret_cast<Type*>(tdata) = Type::DeleteObjects;
     69  tdata += sizeof(Type);
    7070  *(uint32_t *)tdata = number;
    7171  tdata += sizeof(uint32_t);
Note: See TracChangeset for help on using the changeset viewer.