Variants are not singletons anymore.
[tagua/yd.git] / src / entities / gameentity.h
blobeb19ce446b3e890a13289da7d128f03a05429dc5
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 GAMEENTITY_H
12 #define GAMEENTITY_H
14 #include "userentity.h"
15 #include "agent.h"
16 #include "agentgroup.h"
17 #include "fwd.h"
19 class Board;
21 class GameEntity : public UserEntity {
22 VariantPtr m_variant;
23 Board* m_chessboard;
24 AgentGroupDispatcher m_dispatcher;
25 boost::shared_ptr<class Premove> m_premoveQueue;
27 AbstractPosition::Ptr doMove(AbstractMove::Ptr move) const;
28 public:
29 GameEntity(const VariantPtr& variant, const boost::shared_ptr<Game>& game,
30 Board* chessboard, AgentGroup* group);
32 /**
33 * Return a PGN for the game.
35 virtual QString save() const;
37 /**
38 * Load the content of a PGN inside the game.
40 virtual void loadPGN(const PGN& pgn);
42 virtual void executeMove(AbstractMove::Ptr move);
43 virtual void addPremove(const NormalUserMove& m);
44 virtual void addPremove(const DropUserMove& m);
45 virtual void cancelPremove();
47 virtual void notifyClockUpdate(int, int) { }
48 virtual void notifyMove(const Index&);
49 virtual void notifyBack();
50 virtual void notifyForward();
51 virtual void notifyGotoFirst();
52 virtual void notifyGotoLast();
54 virtual AbstractMove::Ptr testMove(const NormalUserMove&) const;
55 virtual AbstractMove::Ptr testMove(const DropUserMove&) const;
56 virtual AbstractPiece::Ptr moveHint(AbstractMove::Ptr move) const;
57 virtual bool testPremove(const NormalUserMove&) const;
58 virtual bool testPremove(const DropUserMove&) const;
59 virtual InteractionType validTurn(const Point&) const;
60 virtual InteractionType validTurn(int) const;
61 virtual bool movable(const Point&) const;
62 virtual bool oneClickMoves() const;
64 virtual bool gotoFirst();
65 virtual bool gotoLast();
66 virtual bool goTo(const Index& index);
67 virtual bool forward();
68 virtual bool back();
69 virtual bool undo();
70 virtual bool redo();
71 virtual bool truncate();
72 virtual bool promoteVariation();
74 virtual bool canDetach() const;
77 #endif // GAMEENTITY_H