4e591bce9b7d3590cdf6b5aa5dd02c472d345cd6
[tagua/yd.git] / src / variants / chess / state.h
blob4e591bce9b7d3590cdf6b5aa5dd02c472d345cd6
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2007 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 CHESS__STATE_H
12 #define CHESS__STATE_H
14 #include <core/board.h>
15 #include <core/component.h>
16 #include <core/state.h>
17 #include <core/piece.h>
18 #include <core/taguaobject.h>
20 /**
21 * @brief Namespace holding Chess components.
23 namespace Chess {
25 class ICastlingRules;
27 class State : public Component, public IState {
28 Q_OBJECT
29 Board m_board;
30 TaguaObject m_flags;
31 const IColor* m_turn;
32 const IBehaviour* m_behaviour;
33 const ICastlingRules* m_castling_rules;
34 IState* m_delegator;
35 protected:
36 State(const State&);
37 public:
38 State(const IBehaviour* behaviour,
39 const ICastlingRules* castling,
40 const Point& size);
41 public:
42 virtual IState* clone() const;
44 virtual void setup();
46 virtual const Board* board() const;
47 virtual Board* board();
49 virtual const IColor* turn() const;
51 virtual void setTurn(const IColor* turn);
53 virtual bool equals(IState* other) const;
55 virtual void assign(const IState* other);
57 virtual void move(const Move& move);
59 virtual TaguaObject* flags();
60 virtual const TaguaObject* flags() const;
62 virtual int rank(int n, const IColor* turn) const;
64 virtual const IPoolCollection* pools() const;
65 virtual IPoolCollection* pools();
67 virtual const IBehaviour* behaviour() const;
69 virtual void setDelegator(IState* delegator);
70 public Q_SLOTS:
71 virtual Point enPassantTrigger(const Move& move) const;
72 virtual Component* clone(const IBehaviour* behaviour,
73 Component* rules,
74 const Point& size) const;
77 } // namespace Chess
79 #endif // CHESS__STATE_H