Changeset 203
- Timestamp:
- Nov 14, 2007, 2:52:03 PM (17 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/PacketDecoder.cc
r199 r203 8 8 PacketDecoder::PacketDecoder(){} 9 9 10 bool PacketDecoder::elaborate( ENet Event* event)10 bool PacketDecoder::elaborate( ENetPacket* packet, int clientId ) 11 11 { 12 int id = (int)*event->packet->data; 12 int client = clientId; 13 cout << "clientId: " << client << endl; 14 int id = (int)*packet->data; 13 15 switch( id ) { 14 16 case ACK: 15 acknowledgement( event->packet );17 acknowledgement( packet ); 16 18 return true; 17 19 break; 18 20 case MOUSE: 19 mousem( event->packet );21 mousem( packet ); 20 22 return true; 21 23 break; 22 24 case KEYBOARD: 23 keystrike( event->packet );25 keystrike( packet ); 24 26 return true; 25 27 break; 26 28 case CHAT: 27 chatMessage( event->packet );29 chatMessage( packet ); 28 30 return true; 29 31 break; … … 62 64 printChat( chatting ); 63 65 } 64 66 /* 65 67 void PacketDecoder::printPeer( ENetPeer* peer ) 66 68 { … … 73 75 cout << "state of peer: " << peer->state << endl; 74 76 } 75 77 */ 76 78 void PacketDecoder::printAck( ack* data ) 77 79 { -
code/branches/network/src/network/PacketManager.h
r199 r203 37 37 char press; 38 38 }; 39 struct chat {40 int id;41 const char* message;42 };43 39 }; 44 40 … … 47 43 public: 48 44 PacketDecoder(); 49 bool elaborate( ENet Event* event);45 bool elaborate( ENetPacket* packet, int clientId ); 50 46 private: 51 47 struct ack { … … 69 65 }; 70 66 71 void acknowledgement( ENetPacket* event );72 void mousem( ENetPacket* event );73 void keystrike( ENetPacket* event );74 void chatMessage( ENetPacket* event );67 void acknowledgement( ENetPacket* packet ); 68 void mousem( ENetPacket* packet ); 69 void keystrike( ENetPacket* packet ); 70 void chatMessage( ENetPacket* packet ); 75 71 76 72 //print functions
Note: See TracChangeset
for help on using the changeset viewer.