- Timestamp:
- Jan 22, 2014, 3:36:37 AM (11 years ago)
- Branches:
- master
- Children:
- e70b66b
- Parents:
- 0678d60
- Location:
- common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/MessageContainer.cpp
r0678d60 r06fc7f7 43 43 } 44 44 45 45 46 void MessageContainer::setTimeAcked(unsigned long long time) { 46 47 this->timeAcked = time; 47 48 } 48 49 49 /* 50 string getMsgTypeString(int msgType) { 50 string MessageContainer::getMsgTypeString(int msgType) { 51 51 switch(msgType) { 52 52 case MSG_TYPE_ACK: return "MSG_TYPE_ACK"; … … 60 60 case MSG_TYPE_REMOVE_OBJECT: return "MSG_TYPE_REMOVE_OBJECT"; 61 61 case MSG_TYPE_PICKUP_FLAG: return "MSG_TYPE_PICKUP_FLAG"; 62 case MSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG";62 case MSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG"; 63 63 case MSG_TYPE_SCORE: return "MSG_TYPE_SCORE"; 64 case MSG_TYPE_START_ATTACK: return "MSG_TYPE_START_ATACK";65 64 case MSG_TYPE_ATTACK: return "MSG_TYPE_ATTACK"; 66 65 case MSG_TYPE_PROJECTILE: return "MSG_TYPE_PROJECTILE"; 67 66 case MSG_TYPE_REMOVE_PROJECTILE: return "MSG_TYPE_REMOVE_PROJECTILE"; 67 case MSG_TYPE_CREATE_GAME: return "MSG_TYPE_CREATE_GAME"; 68 case MSG_TYPE_JOIN_GAME: return "MSG_TYPE_JOIN_GAME"; 69 case MSG_TYPE_LEAVE_GAME: return "MSG_TYPE_LEAVE_GAME"; 70 case MSG_TYPE_GAME_INFO: return "MSG_TYPE_GAME_INFO"; 71 case MSG_TYPE_JOIN_GAME_SUCCESS: return "MSG_TYPE_JOIN_GAME_SUCCESS"; 72 case MSG_TYPE_JOIN_GAME_FAILURE: return "MSG_TYPE_JOIN_GAME_FAILURE"; 73 case MSG_TYPE_JOIN_GAME_ACK: return "MSG_TYPE_JOIN_GAME_ACK"; 74 case MSG_TYPE_PLAYER_JOIN_GAME: return "MSG_TYPE_PLAYER_JOIN_GAME"; 75 case MSG_TYPE_FINISH_GAME: return "MSG_TYPE_FINISH_GAME"; 68 76 default: return "Unknown"; 69 77 } 70 78 } 71 */ -
common/MessageContainer.h
r0678d60 r06fc7f7 14 14 using namespace std; 15 15 16 #define MSG_TYPE_ACK 1 17 #define MSG_TYPE_REGISTER 2 18 #define MSG_TYPE_LOGIN 3 19 #define MSG_TYPE_LOGOUT 4 20 #define MSG_TYPE_CHAT 5 21 #define MSG_TYPE_PLAYER 6 // server sends this to update player positions 22 #define MSG_TYPE_PLAYER_MOVE 7 // client sends this when a player wants to move 23 #define MSG_TYPE_OBJECT 8 24 #define MSG_TYPE_REMOVE_OBJECT 9 25 #define MSG_TYPE_PICKUP_FLAG 10 26 #define MSG_TYPE_DROP_FLAG 11 27 #define MSG_TYPE_SCORE 12 28 #define MSG_TYPE_ATTACK 13 29 #define MSG_TYPE_PROJECTILE 14 30 #define MSG_TYPE_REMOVE_PROJECTILE 15 31 #define MSG_TYPE_CREATE_GAME 16 32 #define MSG_TYPE_JOIN_GAME 17 33 #define MSG_TYPE_LEAVE_GAME 18 34 #define MSG_TYPE_GAME_INFO 19 35 #define MSG_TYPE_JOIN_GAME_SUCCESS 20 36 #define MSG_TYPE_JOIN_GAME_FAILURE 21 37 #define MSG_TYPE_JOIN_GAME_ACK 22 38 #define MSG_TYPE_PLAYER_JOIN_GAME 23 39 #define MSG_TYPE_FINISH_GAME 24 16 enum MessageType { 17 MSG_TYPE_ACK = 1, 18 MSG_TYPE_REGISTER, 19 MSG_TYPE_LOGIN, 20 MSG_TYPE_LOGOUT, 21 MSG_TYPE_CHAT, 22 MSG_TYPE_PLAYER, 23 MSG_TYPE_PLAYER_MOVE, 24 MSG_TYPE_OBJECT, 25 MSG_TYPE_REMOVE_OBJECT, 26 MSG_TYPE_PICKUP_FLAG, 27 MSG_TYPE_DROP_FLAG, 28 MSG_TYPE_SCORE, 29 MSG_TYPE_ATTACK, 30 MSG_TYPE_PROJECTILE, 31 MSG_TYPE_REMOVE_PROJECTILE, 32 MSG_TYPE_CREATE_GAME, 33 MSG_TYPE_JOIN_GAME, 34 MSG_TYPE_LEAVE_GAME, 35 MSG_TYPE_GAME_INFO, 36 MSG_TYPE_JOIN_GAME_SUCCESS, 37 MSG_TYPE_JOIN_GAME_FAILURE, 38 MSG_TYPE_JOIN_GAME_ACK, 39 MSG_TYPE_PLAYER_JOIN_GAME, 40 MSG_TYPE_FINISH_GAME 41 }; 40 42 41 43 typedef struct … … 66 68 void setTimeAcked(unsigned long long time); 67 69 68 static string getMsgTypeString(int msgType) { 69 switch(msgType) { 70 case MSG_TYPE_ACK: return "MSG_TYPE_ACK"; 71 case MSG_TYPE_REGISTER: return "MSG_TYPE_REGISTER"; 72 case MSG_TYPE_LOGIN: return "MSG_TYPE_LOGIN"; 73 case MSG_TYPE_LOGOUT: return "MSG_TYPE_LOGOUT"; 74 case MSG_TYPE_CHAT: return "MSG_TYPE_CHAT"; 75 case MSG_TYPE_PLAYER: return "MSG_TYPE_PLAYER"; 76 case MSG_TYPE_PLAYER_MOVE: return "MSG_TYPE_PLAYER_MOVE"; 77 case MSG_TYPE_OBJECT: return "MSG_TYPE_OBJECT"; 78 case MSG_TYPE_REMOVE_OBJECT: return "MSG_TYPE_REMOVE_OBJECT"; 79 case MSG_TYPE_PICKUP_FLAG: return "MSG_TYPE_PICKUP_FLAG"; 80 case MSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG"; 81 case MSG_TYPE_SCORE: return "MSG_TYPE_SCORE"; 82 case MSG_TYPE_ATTACK: return "MSG_TYPE_ATTACK"; 83 case MSG_TYPE_PROJECTILE: return "MSG_TYPE_PROJECTILE"; 84 case MSG_TYPE_REMOVE_PROJECTILE: return "MSG_TYPE_REMOVE_PROJECTILE"; 85 case MSG_TYPE_CREATE_GAME: return "MSG_TYPE_CREATE_GAME"; 86 case MSG_TYPE_JOIN_GAME: return "MSG_TYPE_JOIN_GAME"; 87 case MSG_TYPE_LEAVE_GAME: return "MSG_TYPE_LEAVE_GAME"; 88 case MSG_TYPE_GAME_INFO: return "MSG_TYPE_GAME_INFO"; 89 case MSG_TYPE_JOIN_GAME_SUCCESS: return "MSG_TYPE_JOIN_GAME_SUCCESS"; 90 case MSG_TYPE_JOIN_GAME_FAILURE: return "MSG_TYPE_JOIN_GAME_FAILURE"; 91 case MSG_TYPE_JOIN_GAME_ACK: return "MSG_TYPE_JOIN_GAME_ACK"; 92 case MSG_TYPE_PLAYER_JOIN_GAME: return "MSG_TYPE_PLAYER_JOIN_GAME"; 93 case MSG_TYPE_FINISH_GAME: return "MSG_TYPE_FINISH_GAME"; 94 default: return "Unknown"; 95 } 96 } 70 static string getMsgTypeString(int msgType); 97 71 }; 98 72
Note:
See TracChangeset
for help on using the changeset viewer.