Initial porting to the new component API.
[tagua/yd.git] / src / variants / chess / state.h
blobd6f5ce1ced592ef201d6ef2068765db2534ce626
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/defaultstate.h>
17 #include <core/piece.h>
18 #include <core/taguaobject.h>
20 namespace Chess {
22 class State : public Component, public IDefaultState {
23 Q_OBJECT
24 Board m_board;
25 TaguaObject m_flags;
26 const IColor* m_turn;
27 public:
28 State(const Point& size);
29 State(const State&);
31 public Q_SLOTS:
33 virtual IState* clone() const;
35 virtual void setup();
37 virtual const Board* board() const;
38 virtual Board* board();
40 virtual const IColor* turn() const;
42 virtual void setTurn(const IColor* turn);
44 virtual bool equals(IState* other) const;
46 virtual void assign(const IState* other);
48 virtual void move(const Move& move);
50 virtual TaguaObject flags() const;
52 virtual Point direction(const IColor* turn) const;
54 virtual void basicMove(const Move& move);
56 virtual void captureOn(const Point& square);
58 virtual int rank(int n, const IColor* turn) const;
60 virtual Point captureSquare(const Move& move) const;
62 virtual void advanceTurn();
64 virtual const IColor* opponent(const IColor* color) const;
66 virtual Point enPassantTrigger(const Move& move) const;
69 } // namespace Chess
71 #endif // CHESS__STATE_H