Add a move-generator API.
[tagua/yd.git] / src / core / delegators / defaultstate.h
blob654fcca4a6a62cf8dbaba0903397256ddd1ccd5b
1 #ifndef DELEGATORS__DEFAULT_STATE_H
2 #define DELEGATORS__DEFAULT_STATE_H
4 #include "../defaultstate.h"
5 #include "state.h"
7 #include <KDebug>
8 #include <typeinfo>
10 namespace Delegators {
12 class DefaultState : public State, public ::DefaultState {
13 protected:
14 ::DefaultState* m_state;
15 public:
16 DefaultState(IState* state)
17 : State(state) {
18 ::DefaultState* dstate = dynamic_cast< ::DefaultState*>(state);
19 if (dstate == NULL) {
20 kError() << "Delegators::DefaultState needs a ::DefaultState, cannot use a"
21 << typeid(state).name();
22 abort();
25 m_state = dstate;
26 m_state->setDelegator(this);
28 virtual ~DefaultState() { delete m_state; }
30 virtual std::vector<const Point*> theoreticalMoves(const Piece& piece,
31 const Point& src) const
32 { return m_state->theoreticalMoves(piece, src); }
35 } // namespace Delegators
37 #endif // DELEGATORS__DEFAULT_STATE_H