refresh 2bd1f2b2b601b1d6c8af11e8be0950eabe44c618
[tagua/yd.git] / src / game_p.h
blobec4efe86bef33ee145696e74d128ff31fd07c926
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
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 <core/move.h>
17 #include <core/state_fwd.h>
18 #include "game.h"
20 namespace GamePrivate {
22 typedef std::map<int, History> Variations;
23 typedef std::map<int, QString> VComments;
25 /**
26 * A class to store game entries
28 class Entry {
29 public:
30 Move move;
31 StatePtr position;
32 QString comment;
33 Variations variations;
34 VComments vcomments;
35 int last_var_id;
37 Entry(const Move& move, const StatePtr& position)
38 : move(move)
39 , position(position)
40 , last_var_id(0) { }
41 Entry()
42 : last_var_id(0) { }
43 ~Entry() { }
46 /* data and structs for undo */
47 class UndoAdd {
48 public:
49 Index index;
50 Entry entry;
51 UndoAdd(const Index& ix, const Entry& e)
52 : index(ix), entry(e) {}
55 class UndoPromote {
56 public:
57 Index index;
58 int variation;
59 UndoPromote(const Index& ix, int v)
60 : index(ix), variation(v) {}
63 class UndoTruncate {
64 public:
65 Index index;
66 History history;
67 Variations variations;
68 VComments vcomments;
69 UndoTruncate(const Index& ix)
70 : index(ix) {}
71 UndoTruncate(const Index& ix, const History& h,
72 const Variations& v, const VComments& c)
73 : index(ix), history(h), variations(v), vcomments(c) {}
76 class UndoRemove {
77 public:
78 Index index;
79 int variation;
80 History history;
81 QString vcomment;
82 UndoRemove(const Index& ix, int v, const History& h, const QString& c)
83 : index(ix), variation(v), history(h), vcomment(c) {}
85 class UndoClear {
86 public:
87 Index index;
88 Variations variations;
89 VComments vcomments;
90 UndoClear(const Index& ix, const Variations& v, const VComments& c)
91 : index(ix), variations(v), vcomments(c) {}
94 class UndoSetComment {
95 public:
96 Index index;
97 int variation;
98 QString old_comment;
99 QString new_comment;
100 UndoSetComment(const Index& ix, int v, const QString& o, const QString& n)
101 : index(ix), variation(v), old_comment(o), new_comment(n) {}
106 #endif //GAME_P_H