Changed my email in the copyright statements.
[tagua/yd.git] / src / entities / icsentity.h
blobabf8ae0d7f8d2c985c83597566f9a0142078692b
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef ICSENTITY_H
12 #define ICSENTITY_H
14 #include "entity.h"
15 #include "agent.h"
16 #include "agentgroup.h"
17 #include "icslistener.h"
18 #include "tagua.h"
19 #include "fwd.h"
21 class ICSConnection;
23 class ICSEntity : public Entity
24 , public Agent
25 , public ICSListener {
26 protected:
27 VariantPtr m_variant;
28 ICSAPIPtr m_icsapi;
30 boost::shared_ptr<ICSConnection> m_connection;
31 int m_side;
32 int m_game_number;
33 bool m_editing_mode;
34 AgentGroupDispatcher m_dispatcher;
36 void updateGame(const Index& index, AbstractMove::Ptr icsMove,
37 AbstractPosition::Ptr icsPos);
39 enum UpdateType {
40 MoveForward,
41 MoveBack,
42 Forward,
43 Back,
44 NoMove,
45 NonComparableIndexes
48 UpdateType getUpdate(const Index& index);
49 public:
50 ICSEntity(const VariantPtr&, const boost::shared_ptr<Game>&,
51 int, int,
52 const boost::shared_ptr<ICSConnection>&, AgentGroup*);
54 virtual void executeMove(AbstractMove::Ptr);
55 virtual void notifyStyle12(const PositionInfo&, bool is_starting);
56 virtual void notifyPool(const class PoolInfo&);
57 virtual void notifyMoveList(int, AbstractPosition::Ptr, const PGN&);
59 virtual AbstractPosition::Ptr position() const;
61 virtual void notifyClockUpdate(int, int) { }
62 virtual void notifyMove(const Index&);
63 virtual void notifyBack() { }
64 virtual void notifyForward() { }
65 virtual void notifyGotoFirst() { }
66 virtual void notifyGotoLast() { }
68 void requestMoves();
70 virtual bool canDetach() const;
71 virtual bool attach();
73 bool canEdit() const;
74 bool canEdit(const Index& index) const;
75 void setupTurnTest(TurnTest& test) const;
78 class ObservingEntity : public ICSEntity {
79 protected:
80 bool m_attached;
81 public:
82 ObservingEntity(const VariantPtr&, const boost::shared_ptr<Game>&,
83 int gameNumber, const boost::shared_ptr<ICSConnection>&, AgentGroup*);
84 ~ObservingEntity();
86 virtual void detach();
89 #endif // ICSENTITY_H