mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
Use Turn objects for the players history too
This commit is contained in:
parent
966418bf98
commit
9e5b6e8ebf
2 changed files with 12 additions and 13 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "results.h"
|
#include "results.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "turn.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
@ -36,10 +37,8 @@ Player::Player()
|
||||||
|
|
||||||
Player::~Player()
|
Player::~Player()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < m_playedRacks.size(); i++)
|
for (unsigned int i = 0; i < m_history.size(); i++)
|
||||||
delete m_playedRacks[i];
|
delete m_history[i];
|
||||||
for (unsigned int i = 0; i < m_rounds.size(); i++)
|
|
||||||
delete m_rounds[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,13 +56,13 @@ void Player::setCurrentRack(const PlayedRack &iPld)
|
||||||
|
|
||||||
const PlayedRack & Player::getLastRack() const
|
const PlayedRack & Player::getLastRack() const
|
||||||
{
|
{
|
||||||
return *m_playedRacks.back();
|
return m_history.back()->getPlayedRack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Round & Player::getLastRound() const
|
const Round & Player::getLastRound() const
|
||||||
{
|
{
|
||||||
return *m_rounds.back();
|
return m_history.back()->getRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,9 +73,8 @@ const Round & Player::getLastRound() const
|
||||||
*/
|
*/
|
||||||
void Player::endTurn(const Round &iRound, int iTurn)
|
void Player::endTurn(const Round &iRound, int iTurn)
|
||||||
{
|
{
|
||||||
m_turns.push_back(iTurn);
|
// FIXME: the number of the player is wrong here!
|
||||||
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));
|
|
||||||
|
|
||||||
Rack rack;
|
Rack rack;
|
||||||
m_pldrack.getRack(rack);
|
m_pldrack.getRack(rack);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "pldrack.h"
|
#include "pldrack.h"
|
||||||
|
|
||||||
class Round;
|
class Turn;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,9 +71,10 @@ private:
|
||||||
PlayedRack m_pldrack;
|
PlayedRack m_pldrack;
|
||||||
|
|
||||||
/// History of the racks and rounds for the player
|
/// History of the racks and rounds for the player
|
||||||
vector<PlayedRack *> m_playedRacks;
|
// vector<PlayedRack *> m_playedRacks;
|
||||||
vector<Round *> m_rounds;
|
// vector<Round *> m_rounds;
|
||||||
vector<int> m_turns;
|
// vector<int> m_turns;
|
||||||
|
vector<Turn*> m_history;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue