24 |
#include "results.h" |
#include "results.h" |
25 |
#include "board.h" |
#include "board.h" |
26 |
#include "player.h" |
#include "player.h" |
27 |
|
#include "turn.h" |
28 |
|
|
29 |
#include "debug.h" |
#include "debug.h" |
30 |
|
|
37 |
|
|
38 |
Player::~Player() |
Player::~Player() |
39 |
{ |
{ |
40 |
for (unsigned int i = 0; i < m_playedRacks.size(); i++) |
for (unsigned int i = 0; i < m_history.size(); i++) |
41 |
delete m_playedRacks[i]; |
delete m_history[i]; |
|
for (unsigned int i = 0; i < m_rounds.size(); i++) |
|
|
delete m_rounds[i]; |
|
42 |
} |
} |
43 |
|
|
44 |
|
|
56 |
|
|
57 |
const PlayedRack & Player::getLastRack() const |
const PlayedRack & Player::getLastRack() const |
58 |
{ |
{ |
59 |
return *m_playedRacks.back(); |
return m_history.back()->getPlayedRack(); |
60 |
} |
} |
61 |
|
|
62 |
|
|
63 |
const Round & Player::getLastRound() const |
const Round & Player::getLastRound() const |
64 |
{ |
{ |
65 |
return *m_rounds.back(); |
return m_history.back()->getRound(); |
66 |
} |
} |
67 |
|
|
68 |
|
|
73 |
*/ |
*/ |
74 |
void Player::endTurn(const Round &iRound, int iTurn) |
void Player::endTurn(const Round &iRound, int iTurn) |
75 |
{ |
{ |
76 |
m_turns.push_back(iTurn); |
// FIXME: the number of the player is wrong here! |
77 |
m_rounds.push_back(new Round(iRound)); |
m_history.push_back(new Turn(iTurn, iTurn, m_pldrack, iRound)); |
|
m_playedRacks.push_back(new PlayedRack(m_pldrack)); |
|
78 |
|
|
79 |
Rack rack; |
Rack rack; |
80 |
m_pldrack.getRack(rack); |
m_pldrack.getRack(rack); |