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.
10 #ifndef DELEGATORS__BEHAVIOUR_H
11 #define DELEGATORS__BEHAVIOUR_H
13 #include "../behaviour.h"
17 namespace Delegators
{
19 class Behaviour
: public IBehaviour
{
21 IBehaviour
* m_dgate_behaviour
;
23 Behaviour(IBehaviour
* delegate
): m_dgate_behaviour(delegate
) {
25 m_dgate_behaviour
->setDelegator(this);
26 //kDebug() << this << "m_dgate_behaviour=" << m_dgate_behaviour;
28 virtual ~Behaviour() { delete m_dgate_behaviour
; }
30 virtual void captureOn(IState
* state
, const Point
& square
) const {
31 m_dgate_behaviour
->captureOn(state
, square
);
33 virtual void move(IState
* state
, const Move
& m
) const {
34 m_dgate_behaviour
->move(state
, m
);
36 virtual void advanceTurn(IState
* state
) const {
37 m_dgate_behaviour
->advanceTurn(state
);
39 virtual Point
captureSquare(const IState
* state
, const Move
& m
) const {
40 return m_dgate_behaviour
->captureSquare(state
, m
);
42 virtual const IColor
* opponent(const IColor
* player
) const {
43 return m_dgate_behaviour
->opponent(player
);
45 virtual Point
direction(const IColor
* player
) const {
46 return m_dgate_behaviour
->direction(player
);
48 virtual void setDelegator(IBehaviour
* behaviour
) {
49 m_dgate_behaviour
->setDelegator(behaviour
);
50 //kDebug() << this << "m_dgate_behaviour=" << m_dgate_behaviour;
56 #endif // DELEGATORS__BEHAVIOUR_H