Merge branch 'pool_rebirth'
[tagua/yd.git] / src / game_p.h
blob795b66c356bc6fbdeefed90754de3b7365dab94d
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef GAME_P_H
12 #define GAME_P_H
14 #include <map>
15 #include <QString>
16 #include "game.h"
18 namespace GamePrivate {
20 typedef std::map<int, History> Variations;
21 typedef std::map<int, QString> VComments;
23 /**
24 * A class to store game entries
26 class Entry {
27 public:
28 MovePtr move;
29 PositionPtr position;
30 QString comment;
31 Variations variations;
32 VComments vcomments;
33 int last_var_id;
35 Entry(MovePtr move, PositionPtr position)
36 : move(move)
37 , position(position)
38 , last_var_id(0) { }
39 Entry()
40 : last_var_id(0) { }
41 ~Entry() { }
44 /* data and structs for undo */
45 class UndoAdd {
46 public:
47 Index index;
48 Entry entry;
49 UndoAdd(const Index& ix, const Entry& e)
50 : index(ix), entry(e) {}
53 class UndoPromote {
54 public:
55 Index index;
56 int variation;
57 UndoPromote(const Index& ix, int v)
58 : index(ix), variation(v) {}
61 class UndoTruncate {
62 public:
63 Index index;
64 History history;
65 Variations variations;
66 VComments vcomments;
67 UndoTruncate(const Index& ix)
68 : index(ix) {}
69 UndoTruncate(const Index& ix, const History& h,
70 const Variations& v, const VComments& c)
71 : index(ix), history(h), variations(v), vcomments(c) {}
74 class UndoRemove {
75 public:
76 Index index;
77 int variation;
78 History history;
79 QString vcomment;
80 UndoRemove(const Index& ix, int v, const History& h, const QString& c)
81 : index(ix), variation(v), history(h), vcomment(c) {}
83 class UndoClear {
84 public:
85 Index index;
86 Variations variations;
87 VComments vcomments;
88 UndoClear(const Index& ix, const Variations& v, const VComments& c)
89 : index(ix), variations(v), vcomments(c) {}
92 class UndoSetComment {
93 public:
94 Index index;
95 int variation;
96 QString old_comment;
97 QString new_comment;
98 UndoSetComment(const Index& ix, int v, const QString& o, const QString& n)
99 : index(ix), variation(v), old_comment(o), new_comment(n) {}
104 #endif //GAME_P_H