Update l10n files, translate into french a bit more.
[tagua/yd.git] / src / entities / userentity.h
blob55e27da73e7c7f07b084f9c2f485bd71a9995bab
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 USERENTITY_H
12 #define USERENTITY_H
14 #ifndef GAMEBASEDRULES_H
15 #define GAMEBASEDRULES_H
17 #include "entity.h"
18 #include "fwd.h"
19 #include "tagua.h"
20 #include "usermove.h"
21 #include "agent.h"
22 #include "turnpolicy.h"
24 class PGN;
26 class UserEntity : public Entity
27 , public Agent {
28 protected:
29 TurnPolicy::Collection m_turn_test;
30 bool m_editing_tools;
31 public:
32 UserEntity(const GamePtr& game);
33 virtual TurnPolicy::Collection& turnTest() { return m_turn_test; }
34 virtual void enableEditingTools(bool value);
36 /**
37 * Return a PGN for the game.
39 virtual QString save() const = 0;
41 /**
42 * Load the content of a PGN inside the game.
44 virtual void loadPGN(const PGN& pgn) = 0;
46 virtual NormalUserMove createMove(const Point& from, const Point& to) const;
47 virtual DropUserMove createDrop(int pool, int index, const Point& to) const;
49 virtual AbstractMove::Ptr testMove(const NormalUserMove& m) const = 0;
50 virtual AbstractMove::Ptr testMove(const DropUserMove& m) const = 0;
52 virtual bool testPremove(const NormalUserMove& m) const = 0;
53 virtual bool testPremove(const DropUserMove&) const = 0;
55 virtual void executeMove(AbstractMove::Ptr move) = 0;
56 virtual void addPremove(const NormalUserMove& m) = 0;
57 virtual void addPremove(const DropUserMove& m) = 0;
58 virtual void cancelPremove() = 0;
59 virtual void handleRightClick(const Point&) const;
61 virtual InteractionType validTurn(const Point&) const = 0;
62 virtual InteractionType validTurn(int) const = 0;
63 virtual bool movable(const Point&) const = 0;
64 virtual bool oneClickMoves() const { return false; }
66 /**
67 * Jump to the end of the game.
69 virtual bool gotoFirst() = 0;
71 /**
72 * Jump to the beginning of the game.
74 virtual bool gotoLast() = 0;
76 /**
77 * Jump to an arbitrary index.
79 virtual bool goTo(const Index& index) = 0;
81 /**
82 * Go forward one move in the game.
84 virtual bool forward() = 0;
86 /**
87 * Go back one move in the game.
89 virtual bool back() = 0;
91 /**
92 * Undo the last editing action.
94 virtual bool undo() = 0;
96 /**
97 * Redo the last editing action.
99 virtual bool redo() = 0;
102 * Remove the current position.
104 virtual bool truncate() = 0;
107 * Promote the current variation to mainline.
109 virtual bool promoteVariation() = 0;
112 * Move hint.
113 * @sa AbstractPosition::moveHint
115 virtual AbstractPiece::Ptr moveHint(AbstractMove::Ptr) const { return AbstractPiece::Ptr(); }
117 virtual bool canDetach() const;
121 #endif // GAMEBASEDRULES_H
124 #endif // USERENTITY_H