push fbe27195cb72bcf9f72636c6745f4e17f1858734
[tagua/yd.git] / src / variants / chess / state.h
blobe9d84cb98e9fc6f0025bdcb0972137d2df593af9
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/state.h>
16 #include <core/piece.h>
17 #include <core/taguaobject.h>
19 /**
20 * @brief Namespace holding Chess components.
22 namespace Chess {
24 class ICastlingRules;
26 class State : public IState {
27 Q_OBJECT
28 Board m_board;
29 TaguaObject m_flags;
30 const IColor* m_turn;
31 const IBehaviour* m_behaviour;
32 const ICastlingRules* m_castling_rules;
33 IState* m_delegator;
34 protected:
35 State(const State&);
36 public:
37 State(const IBehaviour* behaviour,
38 const ICastlingRules* castling,
39 const Point& size);
40 public:
41 virtual IState* clone() const;
43 virtual void setup();
45 virtual const Board* board() const;
46 virtual Board* board();
48 virtual const IColor* turn() const;
50 virtual void setTurn(const IColor* turn);
52 virtual bool equals(IState* other) const;
54 virtual void assign(const IState* other);
56 virtual void move(const Move& move);
58 virtual TaguaObject* flags();
59 virtual const TaguaObject* flags() const;
61 virtual int rank(int n, const IColor* turn) const;
63 virtual const IPoolCollection* pools() const;
64 virtual IPoolCollection* pools();
66 virtual const IBehaviour* behaviour() const;
68 virtual void setDelegator(IState* delegator);
69 public Q_SLOTS:
70 virtual Point enPassantTrigger(const Move& move) const;
71 virtual Component* clone(const IBehaviour* behaviour,
72 Component* rules,
73 const Point& size) const;
76 } // namespace Chess
78 #endif // CHESS__STATE_H