-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameState.cpp
More file actions
29 lines (26 loc) · 761 Bytes
/
GameState.cpp
File metadata and controls
29 lines (26 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "GameState.hpp"
void GameState::LogGamePiece(const std::string& owner,
const std::string& archetype, const bool create) {
// Create Game Piece
if (create) {
player_info[owner][archetype] += 1;
++game_pieces;
// player_info[owner]["Power"] += power;
}
// Destroy Game Piece
else if (!create) {
player_info[owner][archetype] -= 1;
--game_pieces;
// player_info[owner]["Power"] -= power;
}
}
int GameState::NumPieces(const std::string& player) {
int r_pieces = 0;
for (const auto & [ key, val ] : player_info[player]) {
r_pieces += val;
}
return r_pieces;
}
int GameState::NumPieces(const std::string& player, const std::string& type) {
return player_info[player][type];
}