push ca42c908e53955d6cbb94a36f813074e290e2338
[tagua/yd.git] / src / variants / shogi / state.h
blob2b046e6f52c5b70acf8afcec08cd099f1f0a9838
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 SHOGI__STATE_H
12 #define SHOGI__STATE_H
14 #include <core/board.h>
15 #include <core/component.h>
16 #include <core/defaultstate.h>
17 #include <core/piece.h>
18 #include <core/taguaobject.h>
20 /**
21 * @brief Namespace holding Shogi components.
23 namespace Shogi {
25 class State : public Component, public DefaultState {
26 Q_OBJECT
27 Board m_board;
28 TaguaObject m_flags;
29 const IColor* m_turn;
30 const IBehaviour* m_behaviour;
31 IState* m_delegator;
32 IPoolCollection* m_pools;
33 protected:
34 State(const State&);
35 public:
36 State(const IBehaviour* behaviour,
37 const Point& size);
38 virtual ~State();
39 public:
40 virtual IState* clone() const;
42 virtual void setup();
44 virtual const Board* board() const;
45 virtual Board* board();
47 virtual const IColor* turn() const;
49 virtual void setTurn(const IColor* turn);
51 virtual bool equals(IState* other) const;
53 virtual void assign(const IState* other);
55 virtual void move(const Move& move);
57 virtual TaguaObject* flags();
58 virtual const TaguaObject* flags() const;
60 virtual int rank(int n, const IColor* turn) const;
62 virtual const IPoolCollection* pools() const;
63 virtual IPoolCollection* pools();
65 virtual const IBehaviour* behaviour() const;
67 virtual void setDelegator(IState* delegator);
68 public Q_SLOTS:
69 virtual Component* clone(const IBehaviour* behaviour,
70 const Point& size) const;
73 } // namespace Shogi
75 #endif // SHOGI__STATE_H