17 |
/* along with this program; if not, write to the Free Software */ |
/* along with this program; if not, write to the Free Software */ |
18 |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
19 |
|
|
|
/* $Id$ */ |
|
|
|
|
20 |
/** |
/** |
21 |
* \file history.h |
* \file history.h |
22 |
* \brief Game history system |
* \brief Game history system |
28 |
#define _HISTORY_H |
#define _HISTORY_H |
29 |
|
|
30 |
#include <vector> |
#include <vector> |
31 |
#include "turn.h" |
|
32 |
|
class Turn; |
33 |
|
class PlayedRack; |
34 |
|
class Round; |
35 |
|
|
36 |
class History |
class History |
37 |
{ |
{ |
38 |
public: |
public: |
39 |
History(); |
History(); |
40 |
~History(); |
virtual ~History(); |
41 |
|
|
42 |
/// get the size of the history |
/// get the size of the history |
43 |
int getSize() const; |
int getSize() const; |
44 |
|
|
45 |
/// Get the (possibly incomplete) rack |
/// Get the (possibly incomplete) rack |
46 |
const PlayedRack getCurrentRack() const; |
const PlayedRack& getCurrentRack() const; |
47 |
|
|
48 |
/// Set the current rack |
/// Set the current rack |
49 |
void setCurrentRack(const PlayedRack &iPld); |
void setCurrentRack(const PlayedRack &iPld); |
50 |
|
|
51 |
/// Get the previous turn |
/// Get the previous turn |
52 |
const Turn getPreviousTurn() const; |
const Turn& getPreviousTurn() const; |
53 |
|
|
54 |
/// Get turn 'n' |
/// Get turn 'n' |
55 |
const Turn getTurn(unsigned int) const; |
const Turn& getTurn(unsigned int) const; |
56 |
|
|
57 |
/// Update the "history" with the given round and, complete the turn. |
/// Update the "history" with the given round and complete the turn. |
58 |
/// a new turn is created with the remaining letters in the rack |
/// A new turn is created with the remaining letters in the rack |
59 |
void playRound(int player, int turn, const Round& round); |
void playRound(int player, int turn, const Round& round); |
60 |
|
|
61 |
/// Remove last turn |
/// Remove last turn |
62 |
void removeLastTurn(); |
void removeLastTurn(); |
63 |
|
|
64 |
/// String handling |
/// String handling |
65 |
std::string toString() const; |
std::string toString() const; |
66 |
|
|
67 |
private: |
private: |
68 |
std::vector < Turn* > history; |
std::vector < Turn* > m_history; |
69 |
}; |
}; |
70 |
|
|
71 |
#endif |
#endif |
72 |
|
|
73 |
|
|
74 |
/// Local Variables: |
/// Local Variables: |
75 |
/// mode: hs-minor |
/// mode: hs-minor |
76 |
/// c-basic-offset: 4 |
/// c-basic-offset: 4 |