Changeset 3280 for code/trunk/src/network/packet/Packet.cc
- Timestamp:
- Jul 12, 2009, 11:58:01 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core4 (added) merged: 3235-3237,3245-3250,3253-3254,3260-3261,3265,3270
- Property svn:mergeinfo changed
-
code/trunk/src/network/packet/Packet.cc
r3214 r3280 63 63 Packet::Packet(){ 64 64 flags_ = PACKET_FLAG_DEFAULT; 65 packetDirection_ = ENUM::Outgoing;65 packetDirection_ = Direction::Outgoing; 66 66 clientID_=0; 67 67 data_=0; … … 76 76 Packet::Packet(uint8_t *data, unsigned int clientID){ 77 77 flags_ = PACKET_FLAG_DEFAULT; 78 packetDirection_ = ENUM::Incoming;78 packetDirection_ = Direction::Incoming; 79 79 clientID_=clientID; 80 80 data_=data; … … 125 125 126 126 bool Packet::send(){ 127 if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){127 if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional ){ 128 128 assert(0); 129 129 return false; … … 147 147 } 148 148 #ifndef NDEBUG 149 switch( *( ENUM::Type *)(data_ + _PACKETID) )149 switch( *(Type::Value *)(data_ + _PACKETID) ) 150 150 { 151 case ENUM::Acknowledgement:152 case ENUM::Chat:153 case ENUM::ClassID:154 case ENUM::Gamestate:155 case ENUM::Welcome:156 case ENUM::DeleteObjects:157 case ENUM::FunctionIDs:158 case ENUM::FunctionCalls:151 case Type::Acknowledgement: 152 case Type::Chat: 153 case Type::ClassID: 154 case Type::Gamestate: 155 case Type::Welcome: 156 case Type::DeleteObjects: 157 case Type::FunctionIDs: 158 case Type::FunctionCalls: 159 159 break; 160 160 default: … … 175 175 unsigned int clientID = ClientInformation::findClient(&peer->address)->getID(); 176 176 Packet *p = 0; 177 COUT(6) << "packet type: " << *( ENUM::Type *)&data[_PACKETID] << std::endl;178 switch( *( ENUM::Type *)(data + _PACKETID) )177 COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl; 178 switch( *(Type::Value *)(data + _PACKETID) ) 179 179 { 180 case ENUM::Acknowledgement:180 case Type::Acknowledgement: 181 181 COUT(5) << "ack" << std::endl; 182 182 p = new Acknowledgement( data, clientID ); 183 183 break; 184 case ENUM::Chat:184 case Type::Chat: 185 185 COUT(5) << "chat" << std::endl; 186 186 p = new Chat( data, clientID ); 187 187 break; 188 case ENUM::ClassID:188 case Type::ClassID: 189 189 COUT(5) << "classid" << std::endl; 190 190 p = new ClassID( data, clientID ); 191 191 break; 192 case ENUM::Gamestate:192 case Type::Gamestate: 193 193 COUT(5) << "gamestate" << std::endl; 194 194 // TODO: remove brackets 195 195 p = new Gamestate( data, clientID ); 196 196 break; 197 case ENUM::Welcome:197 case Type::Welcome: 198 198 COUT(5) << "welcome" << std::endl; 199 199 p = new Welcome( data, clientID ); 200 200 break; 201 case ENUM::DeleteObjects:201 case Type::DeleteObjects: 202 202 COUT(5) << "deleteobjects" << std::endl; 203 203 p = new DeleteObjects( data, clientID ); 204 204 break; 205 case ENUM::FunctionCalls:205 case Type::FunctionCalls: 206 206 COUT(5) << "functionCalls" << std::endl; 207 207 p = new FunctionCalls( data, clientID ); 208 208 break; 209 case ENUM::FunctionIDs:209 case Type::FunctionIDs: 210 210 COUT(5) << "functionIDs" << std::endl; 211 211 p = new FunctionIDs( data, clientID );
Note: See TracChangeset
for help on using the changeset viewer.