2447a94cc97fda81584fd2d8572b3a0318fd4256
[tagua/yd.git] / src / core / delegators / behaviour.h
blob2447a94cc97fda81584fd2d8572b3a0318fd4256
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 */
10 #ifndef DELEGATORS__BEHAVIOUR_H
11 #define DELEGATORS__BEHAVIOUR_H
13 #include "../behaviour.h"
15 namespace Delegators {
17 class Behaviour : public IBehaviour {
18 protected:
19 const IBehaviour* m_dgate_behaviour;
20 public:
21 Behaviour(const IBehaviour* behaviour) : m_dgate_behaviour(behaviour) { }
22 virtual ~Behaviour() { delete m_dgate_behaviour; }
24 virtual void captureOn(IState* state, const Point& square) const {
25 m_dgate_behaviour->captureOn(state, square);
27 virtual void move(IState* state, const Move& m) const {
28 m_dgate_behaviour->move(state, m);
30 virtual void advanceTurn(IState* state) const {
31 m_dgate_behaviour->advanceTurn(state);
33 virtual Point captureSquare(const IState* state, const Move& m) const {
34 return m_dgate_behaviour->captureSquare(state, m);
36 virtual const IColor* opponent(const IColor* player) const {
37 return m_dgate_behaviour->opponent(player);
39 virtual Point direction(const IColor* player) const {
40 return m_dgate_behaviour->direction(player);
46 #endif // DELEGATORS__BEHAVIOUR_H