Initial porting to the new component API.
[tagua/yd.git] / src / entities / gameentity.h
blobb312486c685f612d9fe66ac6cd3c3fc70eee6e08
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 GAMEENTITY_H
12 #define GAMEENTITY_H
14 #include <core/state_fwd.h>
15 #include "agent.h"
16 #include "agentgroup.h"
17 #include "userentity.h"
19 class ChessBoard;
20 class IPolicy;
21 class IValidator;
22 class Variant;
24 class GameEntity : public UserEntity {
25 Variant* m_variant;
26 IPolicy* m_policy;
27 IValidator* m_validator;
28 ChessBoard* m_chessboard;
29 AgentGroupDispatcher m_dispatcher;
30 Move m_premoveQueue;
32 StatePtr doMove(const Move& move) const;
33 public:
34 GameEntity(Variant* variant, const boost::shared_ptr<Game>& game,
35 ChessBoard* chessboard, AgentGroup* group);
37 /**
38 * Return a PGN for the game.
40 virtual QString save() const;
42 /**
43 * Load the content of a PGN inside the game.
45 virtual void loadPGN(const PGN& pgn);
47 virtual void executeMove(const Move& move);
48 virtual void addPremove(const Move& m);
49 virtual void cancelPremove();
51 virtual void notifyClockUpdate(int, int) { }
52 virtual void notifyMove(const Index&);
53 virtual void notifyBack();
54 virtual void notifyForward();
55 virtual void notifyGotoFirst();
56 virtual void notifyGotoLast();
58 virtual bool testMove(Move&) const;
59 virtual bool testPremove(const Move&) const;
60 virtual Piece moveHint(const Move& move) const;
62 virtual InteractionType validTurn(const Point&) const;
63 virtual InteractionType validTurn(const IColor*) const;
64 virtual bool movable(const Point&) const;
65 virtual bool oneClickMoves() const;
67 virtual bool gotoFirst();
68 virtual bool gotoLast();
69 virtual bool goTo(const Index& index);
70 virtual bool forward();
71 virtual bool back();
72 virtual bool undo();
73 virtual bool redo();
74 virtual bool truncate();
75 virtual bool promoteVariation();
77 virtual bool canDetach() const;
80 #endif // GAMEENTITY_H