Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2008, 3:31:22 PM (16 years ago)
Author:
scheusso
Message:

removed shipdid from welcome because it's not needed anymore

File:
1 edited

Legend:

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

    r2371 r2483  
    4242#define _PACKETID             0
    4343#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
    44 #define _SHIPID               _CLIENTID + sizeof(uint32_t)
    45 #define _ENDIANTEST           _SHIPID + sizeof(uint32_t)
     44#define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
    4645 
    47   Welcome::Welcome( unsigned int clientID, unsigned int shipID )
     46  Welcome::Welcome( uint32_t clientID, uint32_t shipID )
    4847 : Packet()
    4948{
     
    5352  assert(data_);
    5453  *(packet::ENUM::Type *)(data_ + _PACKETID ) = packet::ENUM::Welcome;
    55   *(uint32_t *)(data_ + _CLIENTID ) = clientID;
    56   *(uint32_t *)(data_ + _SHIPID ) = shipID;
     54  *(uint32_t *)(data_ + _CLIENTID ) = static_cast<uint32_t>(clientID);
    5755  *(uint32_t *)(data_ + _ENDIANTEST ) = 0xFEDC4321;
    5856}
    5957
    60 Welcome::Welcome( uint8_t* data, unsigned int clientID )
     58Welcome::Welcome( uint8_t* data, uint32_t clientID )
    6159  : Packet(data, clientID)
    6260{
     
    7270
    7371unsigned int Welcome::getSize() const{
    74   return sizeof(packet::ENUM::Type) + 3*sizeof(uint32_t);
     72  return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t);
    7573}
    7674
    7775bool Welcome::process(){
    78   unsigned int shipID, clientID;
    79   clientID = *(uint32_t *)&data_[ _CLIENTID ];
    80   shipID = *(uint32_t *)&data_[ _SHIPID ];
     76  uint32_t shipID, clientID;
     77  clientID = *(uint32_t *)(data_ + _CLIENTID );
    8178  assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
    8279  Host::setClientID(clientID);
    83   Host::setShipID(shipID);
    84   COUT(3) << "Welcome set clientId: " << clientID << " shipID: " << shipID << std::endl;
     80  COUT(3) << "Welcome set clientId: " << clientID << endl;
    8581  Synchronisable::setClient(true);
    8682  delete this;
Note: See TracChangeset for help on using the changeset viewer.