Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2008, 7:40:47 PM (16 years ago)
Author:
scheusso
Message:

merged network branch back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/packet/Welcome.cc

    r1763 r1907  
    4242#define _PACKETID             0
    4343#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
    44 #define _SHIPID               _CLIENTID + sizeof(unsigned int)
     44#define _SHIPID               _CLIENTID + sizeof(uint32_t)
    4545 
    4646  Welcome::Welcome( unsigned int clientID, unsigned int shipID )
     
    4949  flags_ = flags_ | PACKET_FLAGS_CLASSID;
    5050  assert(getSize());
    51   data_=new unsigned char[ getSize() ];
     51  data_=new uint8_t[ getSize() ];
    5252  assert(data_);
    5353  *(packet::ENUM::Type *)(data_ + _PACKETID ) = packet::ENUM::Welcome;
    54   *(unsigned int *)&data_[ _CLIENTID ] = clientID;
    55   *(unsigned int *)&data_[ _SHIPID ] = shipID;
     54  *(uint32_t *)&data_[ _CLIENTID ] = clientID;
     55  *(uint32_t *)&data_[ _SHIPID ] = shipID;
    5656}
    5757
    58 Welcome::Welcome( unsigned char *data, int clientID )
     58Welcome::Welcome( uint8_t* data, unsigned int clientID )
    5959  : Packet(data, clientID)
    6060{
     
    6565}
    6666
    67 unsigned char *Welcome::getData(){
     67uint8_t *Welcome::getData(){
    6868  return data_;
    6969}
    7070
    7171unsigned int Welcome::getSize() const{
    72   return sizeof(network::packet::ENUM::Type) + 2*sizeof(unsigned int);
     72  return sizeof(network::packet::ENUM::Type) + 2*sizeof(uint32_t);
    7373}
    7474
    7575bool Welcome::process(){
    7676  unsigned int shipID, clientID;
    77   clientID = *(unsigned int *)&data_[ _CLIENTID ];
    78   shipID = *(unsigned int *)&data_[ _SHIPID ];
     77  clientID = *(uint32_t *)&data_[ _CLIENTID ];
     78  shipID = *(uint32_t *)&data_[ _SHIPID ];
    7979  Host::setClientID(clientID);
    8080  Host::setShipID(shipID);
Note: See TracChangeset for help on using the changeset viewer.