|
2 | 2 |
|
3 | 3 | #include <algorithm>
|
4 | 4 |
|
| 5 | +static const char CLIENT_ATTACK_CMD_NAME[] = "CLIENT_ATTACK"; |
| 6 | +static const char SERVER_START_BROADCAST_CMD_NAME[] = "SERVER_START_BROADCAST"; |
| 7 | +static const char ENEMY_DIED_CMD_NAME[] = "ENEMY_DIED"; |
| 8 | +static const char ENEMY_REVIVED_CMD_NAME[] = "ENEMY_REVIVED"; |
| 9 | + |
5 | 10 | GameCommands::GameCommands():
|
6 |
| - CLIENT_ATTACK_CMD_NAME("CLIENT_ATTACK"), |
7 |
| - SERVER_START_BROADCAST_CMD_NAME("SERVER_START_BROADCAST"), |
8 |
| - ENEMY_DIED_CMD_NAME("ENEMY_DIED"), |
9 |
| - ENEMY_REVIVED_CMD_NAME("ENEMY_REVIVED"), |
10 |
| - game_commands_map({{this->CLIENT_ATTACK_CMD_NAME, 0x03}, |
11 |
| - {this->SERVER_START_BROADCAST_CMD_NAME, 0x06}, |
12 |
| - {this->ENEMY_DIED_CMD_NAME, 0x04}, |
13 |
| - {this->ENEMY_REVIVED_CMD_NAME, 0x05}}) {} |
| 11 | + game_commands_map({{CLIENT_ATTACK_CMD_NAME, 0x03}, |
| 12 | + {SERVER_START_BROADCAST_CMD_NAME, 0x06}, |
| 13 | + {ENEMY_DIED_CMD_NAME, 0x04}, |
| 14 | + {ENEMY_REVIVED_CMD_NAME, 0x05}}) {} |
14 | 15 |
|
15 | 16 |
|
16 | 17 | const uint8_t GameCommands::get_client_attack_code() const {
|
17 |
| - return this->game_commands_map.at(this->CLIENT_ATTACK_CMD_NAME); |
| 18 | + return this->game_commands_map.at(CLIENT_ATTACK_CMD_NAME); |
18 | 19 | }
|
19 | 20 |
|
20 | 21 |
|
21 | 22 | const uint8_t GameCommands::get_server_start_broadcast_code() const {
|
22 |
| - return this->game_commands_map.at(this->SERVER_START_BROADCAST_CMD_NAME); |
| 23 | + return this->game_commands_map.at(SERVER_START_BROADCAST_CMD_NAME); |
23 | 24 | }
|
24 | 25 |
|
25 | 26 |
|
26 | 27 | const uint8_t GameCommands::get_enemy_died_code() const {
|
27 |
| - return this->game_commands_map.at(this->ENEMY_DIED_CMD_NAME); |
| 28 | + return this->game_commands_map.at(ENEMY_DIED_CMD_NAME); |
28 | 29 | }
|
29 | 30 |
|
30 | 31 |
|
31 | 32 | const uint8_t GameCommands::get_enemy_revived_code() const {
|
32 |
| - return this->game_commands_map.at(this->ENEMY_REVIVED_CMD_NAME); |
| 33 | + return this->game_commands_map.at(ENEMY_REVIVED_CMD_NAME); |
33 | 34 | }
|
34 | 35 |
|
35 | 36 |
|
|
0 commit comments