Preliminary port of Shogi to the component API.
[tagua/yd.git] / src / variants / shogi / behaviour.h
blob52313e5db0a45aa7f5a3f982e816c449de21eb6d
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 SHOGI__BEHAVIOUR_H
11 #define SHOGI__BEHAVIOUR_H
13 #include <core/delegators/behaviour.h>
14 #include <core/promotionmanager.h>
16 class Move;
18 namespace Shogi {
20 class TAGUA_EXPORT Behaviour : public Delegators::Behaviour {
21 Q_OBJECT
22 PromotionManager* m_promotionmanager;
23 IBehaviour* m_delegator;
24 public:
25 Behaviour(IBehaviour* behaviour);
26 virtual IBehaviour* clone() const;
27 virtual void captureOn(IState* state, const Point& square) const;
28 virtual void setDelegator(IBehaviour* behaviour);
30 public Q_SLOTS:
31 void setPromotionManager(PromotionManager* pm) {
32 m_promotionmanager = pm;
33 kDebug() << this << "m_promotionmanager=" << m_promotionmanager;
35 const PromotionManager* promotionManager() const {
36 if (!m_promotionmanager)
37 kError() << "no promotion manager";
38 return m_promotionmanager;
41 bool mayPromote(const IState* state, const Move& move) const;
42 unsigned promotionZoneWidth() const { return 3; }
44 virtual IBehaviour* clone(PromotionManager* pm) const;
47 } // namespace Shogi
49 #endif // SHOGI__BEHAVIOUR_H