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.
14 #ifndef GAMEBASEDRULES_H
15 #define GAMEBASEDRULES_H
17 #include <core/interactiontype.h>
18 #include <core/move.h>
19 #include <core/piece.h>
20 #include <core/turnpolicy.h>
27 class UserEntity
: public Entity
30 TurnPolicy::Collection m_turn_test
;
33 UserEntity(const GamePtr
& game
);
34 virtual TurnPolicy::Collection
& turnTest() { return m_turn_test
; }
35 virtual void enableEditingTools(bool value
);
38 * Return a PGN for the game.
40 virtual QString
save() const = 0;
43 * Load the content of a PGN inside the game.
45 virtual void loadPGN(const PGN
& pgn
) = 0;
47 virtual bool testMove(Move
& m
) const = 0;
49 virtual bool testPremove(const Move
& m
) const = 0;
50 virtual void executeMove(const Move
& move
) = 0;
51 virtual void addPremove(const Move
& m
) = 0;
52 virtual void cancelPremove() = 0;
53 virtual void handleRightClick(const Point
&) const;
55 virtual InteractionType
validTurn(const Point
&) const = 0;
56 virtual InteractionType
validTurn(const IColor
*) const = 0;
57 virtual bool movable(const Point
&) const = 0;
58 virtual bool oneClickMoves() const { return false; }
61 * Jump to the end of the game.
63 virtual bool gotoFirst() = 0;
66 * Jump to the beginning of the game.
68 virtual bool gotoLast() = 0;
71 * Jump to an arbitrary index.
73 virtual bool goTo(const Index
& index
) = 0;
76 * Go forward one move in the game.
78 virtual bool forward() = 0;
81 * Go back one move in the game.
83 virtual bool back() = 0;
86 * Undo the last editing action.
88 virtual bool undo() = 0;
91 * Redo the last editing action.
93 virtual bool redo() = 0;
96 * Remove the current position.
98 virtual bool truncate() = 0;
101 * Promote the current variation to mainline.
103 virtual bool promoteVariation() = 0;
108 virtual Piece
moveHint(const Move
&) const { return Piece(); }
110 virtual bool canDetach() const;
114 #endif // GAMEBASEDRULES_H
117 #endif // USERENTITY_H