Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2737


Ignore:
Timestamp:
Mar 4, 2009, 12:37:49 PM (16 years ago)
Author:
scheusso
Message:

removed some inconsistencies (data types)

Location:
code/branches/network/src/network/packet
Files:
2 edited

Legend:

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

    r2669 r2737  
    3939
    4040
    41   ClassID::ClassID( unsigned int classID, std::string className )
     41  ClassID::ClassID( uint32_t classID, std::string className )
    4242 : Packet()
    4343{
     
    4848  assert(data_);
    4949  *(ENUM::Type *)(data_ + _PACKETID ) = ENUM::ClassID;
    50   *(unsigned int *)(data_ + _CLASSID ) = classID;
    51   *(unsigned int *)(data_ + _CLASSNAMELENGTH ) = classNameLength_;
     50  *(uint32_t *)(data_ + _CLASSID ) = classID;
     51  *(uint32_t *)(data_ + _CLASSNAMELENGTH ) = classNameLength_;
    5252  memcpy( data_+_CLASSNAME, (void *)className.c_str(), classNameLength_ );
    5353}
     
    6363}
    6464
    65 unsigned int ClassID::getSize() const{
    66   return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_;
    67 }
    6865
    6966bool ClassID::process(){
    7067  COUT(3) << "processing classid: " << getClassID() << " name: " << getClassName() << std::endl;
    7168  Identifier *id=ClassByString( std::string(getClassName()) );
    72   if(id==NULL)
    73     return false;
     69  if(id==NULL){
     70    COUT(0) << "Recieved a bad classname" << endl;
     71    abort();
     72  }
    7473  id->setNetworkID( getClassID() );
    7574  delete this;
     
    7877
    7978
    80 unsigned int ClassID::getClassID(){
     79uint32_t ClassID::getClassID(){
    8180  return *(uint32_t *)(data_ + _CLASSID);
    8281}
  • code/branches/network/src/network/packet/ClassID.h

    r2669 r2737  
    5050{
    5151public:
    52   ClassID( unsigned int classID, std::string className );
     52  ClassID( uint32_t classID, std::string className );
    5353  ClassID( uint8_t* data, unsigned int clientID );
    5454  ~ClassID();
    5555
    56   inline unsigned int getSize() const;
     56  inline uint32_t getSize() const{ return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_; }
    5757  bool process();
    5858
    59   unsigned int getClassID();
    60   unsigned int getClassNameLength(){ return classNameLength_; }
     59  uint32_t getClassID();
     60  uint32_t getClassNameLength(){ return classNameLength_; }
    6161  const char *getClassName(){ return (const char*)(data_+_CLASSNAME); }
    6262private:
Note: See TracChangeset for help on using the changeset viewer.