Changeset 9bfc1cb in network-game
- Timestamp:
- Dec 27, 2013, 8:55:07 PM (11 years ago)
- Branches:
- master
- Children:
- 3ff2bd7
- Parents:
- f63aa57
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/MessageContainer.h
rf63aa57 r9bfc1cb 26 26 #define MSG_TYPE_DROP_FLAG 11 27 27 #define MSG_TYPE_SCORE 12 28 #define MSG_TYPE_START_ATTACK 13 29 #define MSG_TYPE_ATTACK 14 30 #define MSG_TYPE_PROJECTILE 15 31 #define MSG_TYPE_REMOVE_PROJECTILE 16 32 #define MSG_TYPE_CREATE_GAME 17 33 #define MSG_TYPE_JOIN_GAME 18 34 #define MSG_TYPE_LEAVE_GAME 19 35 #define MSG_TYPE_GAME_INFO 20 36 #define MSG_TYPE_JOIN_GAME_SUCCESS 21 37 #define MSG_TYPE_JOIN_GAME_FAILURE 22 38 #define MSG_TYPE_JOIN_GAME_ACK 23 39 #define MSG_TYPE_PLAYER_JOIN_GAME 24 40 #define MSG_TYPE_FINISH_GAME 25 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 41 40 42 41 typedef struct … … 81 80 case MSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG"; 82 81 case MSG_TYPE_SCORE: return "MSG_TYPE_SCORE"; 83 case MSG_TYPE_START_ATTACK: return "MSG_TYPE_START_ATACK";84 82 case MSG_TYPE_ATTACK: return "MSG_TYPE_ATTACK"; 85 83 case MSG_TYPE_PROJECTILE: return "MSG_TYPE_PROJECTILE"; 86 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"; 87 94 default: return "Unknown"; 88 95 } -
server/server.cpp
rf63aa57 r9bfc1cb 607 607 break; 608 608 } 609 case MSG_TYPE_ START_ATTACK:609 case MSG_TYPE_ATTACK: 610 610 { 611 611 cout << "Received a START_ATTACK message" << endl; … … 624 624 map<unsigned int, Player*> players = p->currentGame->getPlayers(); 625 625 626 serverMsg.type = MSG_TYPE_ START_ATTACK;626 serverMsg.type = MSG_TYPE_ATTACK; 627 627 memcpy(serverMsg.buffer, &id, 4); 628 628 memcpy(serverMsg.buffer+4, &targetId, 4); … … 1057 1057 cout << "about to broadcast attack" << endl; 1058 1058 1059 serverMsg.type = MSG_TYPE_ATTACK;1060 memcpy(serverMsg.buffer, &p->id, 4);1061 memcpy(serverMsg.buffer+4, &p->targetPlayer, 4);1062 broadcastMessage(msgProcessor, serverMsg, playersInGame);1063 1064 1059 if (p->attackType == Player::ATTACK_MELEE) 1065 1060 {
Note:
See TracChangeset
for help on using the changeset viewer.