1f890eccea88615ab12a1eded28af31cf81617ec
[tagua/yd.git] / src / core / delegators / behaviour.h
blob1f890eccea88615ab12a1eded28af31cf81617ec
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_behaviour;
20 public:
21 Behaviour(const IBehaviour* behaviour) : m_behaviour(behaviour) { }
22 virtual ~Behaviour() { delete m_behaviour; }
24 virtual void captureOn(IState* state, const Point& square) const {
25 m_behaviour->captureOn(state, square);
27 virtual void move(IState* state, const Move& m) const { m_behaviour->move(state, m); }
28 virtual void advanceTurn(IState* state) const { m_behaviour->advanceTurn(state); }
29 virtual Point captureSquare(const IState* state, const Move& m) const {
30 return m_behaviour->captureSquare(state, m);
32 virtual const IColor* opponent(const IColor* player) const {
33 return m_behaviour->opponent(player);
35 virtual Point direction(const IColor* player) const {
36 return m_behaviour->direction(player);
42 #endif // DELEGATORS__BEHAVIOUR_H