push dba7844810ccf5dada78def48e30e1669c45d321
[tagua/yd.git] / src / variants / chess / state.h
blob0918b72c20d2c742c8b2688accb40443659ee0c7
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 namespace Chess {
22 class ICastlingRules;
24 class State : public Component, public IState {
25 Q_OBJECT
26 Board m_board;
27 TaguaObject m_flags;
28 const IColor* m_turn;
29 const IBehaviour* m_behaviour;
30 const ICastlingRules* m_castling_rules;
31 IState* m_delegator;
32 protected:
33 State(const State&);
34 public:
35 State(const IBehaviour* behaviour,
36 const ICastlingRules* castling,
37 const Point& size);
38 public:
39 virtual IState* clone() const;
41 virtual void setup();
43 virtual const Board* board() const;
44 virtual Board* board();
46 virtual const IColor* turn() const;
48 virtual void setTurn(const IColor* turn);
50 virtual bool equals(IState* other) const;
52 virtual void assign(const IState* other);
54 virtual void move(const Move& move);
56 virtual TaguaObject* flags();
57 virtual const TaguaObject* flags() const;
59 virtual int rank(int n, const IColor* turn) const;
61 virtual const IPoolCollection* pools() const;
62 virtual IPoolCollection* pools();
64 virtual const IBehaviour* behaviour() const;
66 virtual void setDelegator(IState* delegator);
67 public Q_SLOTS:
68 virtual Point enPassantTrigger(const Move& move) const;
69 virtual Component* clone(const IBehaviour* behaviour,
70 Component* rules,
71 const Point& size) const;
74 } // namespace Chess
76 #endif // CHESS__STATE_H