-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessPlayer.cpp
More file actions
40 lines (34 loc) · 1.01 KB
/
Copy pathChessPlayer.cpp
File metadata and controls
40 lines (34 loc) · 1.01 KB
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
30
31
32
33
34
35
36
37
38
39
40
#include "ChessPlayer.h"
ChessPlayer::ChessPlayer()
{
//ctor
}
ChessPlayer::~ChessPlayer()
{
//dtor
}
std::vector<ChessPiece*> ChessPlayer::getAllPieces(){
std::map<char,std::vector<ChessPiece*> >::iterator pieces = m_availablePieces.begin();
std::vector<ChessPiece*> ret;
while (pieces != m_availablePieces.end()){
std::vector<ChessPiece*> chessPieceType = pieces->second;
for (unsigned int i = 0; i < chessPieceType.size(); i++){
ret.push_back(chessPieceType[i]);
}
pieces++;
}
return ret;
}
std::vector<ChessPiece*> ChessPlayer::GetAvailableRequestedPieces(char piece){
std::vector<ChessPiece*> playersPieces(m_availablePieces[piece]);
std::vector<ChessPiece*> availablePieces;
std::vector<ChessPiece*>::iterator iter = playersPieces.begin();
while (iter != playersPieces.end()){
if ((*iter)->GetIsAvailable())
{
availablePieces.push_back(*iter);
}
iter++;
}
return availablePieces;
}