Changeset 2737
- Timestamp:
- Mar 4, 2009, 12:37:49 PM (16 years ago)
- Location:
- code/branches/network/src/network/packet
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/packet/ClassID.cc
r2669 r2737 39 39 40 40 41 ClassID::ClassID( u nsigned int classID, std::string className )41 ClassID::ClassID( uint32_t classID, std::string className ) 42 42 : Packet() 43 43 { … … 48 48 assert(data_); 49 49 *(ENUM::Type *)(data_ + _PACKETID ) = ENUM::ClassID; 50 *(u nsigned int *)(data_ + _CLASSID ) = classID;51 *(u nsigned int *)(data_ + _CLASSNAMELENGTH ) = classNameLength_;50 *(uint32_t *)(data_ + _CLASSID ) = classID; 51 *(uint32_t *)(data_ + _CLASSNAMELENGTH ) = classNameLength_; 52 52 memcpy( data_+_CLASSNAME, (void *)className.c_str(), classNameLength_ ); 53 53 } … … 63 63 } 64 64 65 unsigned int ClassID::getSize() const{66 return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_;67 }68 65 69 66 bool ClassID::process(){ 70 67 COUT(3) << "processing classid: " << getClassID() << " name: " << getClassName() << std::endl; 71 68 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 } 74 73 id->setNetworkID( getClassID() ); 75 74 delete this; … … 78 77 79 78 80 u nsigned int ClassID::getClassID(){79 uint32_t ClassID::getClassID(){ 81 80 return *(uint32_t *)(data_ + _CLASSID); 82 81 } -
code/branches/network/src/network/packet/ClassID.h
r2669 r2737 50 50 { 51 51 public: 52 ClassID( u nsigned int classID, std::string className );52 ClassID( uint32_t classID, std::string className ); 53 53 ClassID( uint8_t* data, unsigned int clientID ); 54 54 ~ClassID(); 55 55 56 inline u nsigned int getSize() const;56 inline uint32_t getSize() const{ return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_; } 57 57 bool process(); 58 58 59 u nsigned int getClassID();60 u nsigned int getClassNameLength(){ return classNameLength_; }59 uint32_t getClassID(); 60 uint32_t getClassNameLength(){ return classNameLength_; } 61 61 const char *getClassName(){ return (const char*)(data_+_CLASSNAME); } 62 62 private:
Note: See TracChangeset
for help on using the changeset viewer.