Pol  Revision:cb584c9
target.h
Go to the documentation of this file.
1 
7 #ifndef __TARGET_H
8 #define __TARGET_H
9 
10 #include <array>
11 
12 #include "../clib/compilerspecifics.h"
13 #include "../clib/rawtypes.h"
14 #include "pktboth.h"
15 
16 namespace Pol
17 {
18 namespace Mobile
19 {
20 class Character;
21 }
22 namespace Network
23 {
24 class Client;
25 }
26 namespace Core
27 {
28 class UObject;
29 
30 // The TargetCursor self-registers with the "PKTBI_6C" handler.
31 
33 {
34  friend struct Cursors;
35 
36 protected:
37  explicit TargetCursor( bool inform_on_cancel );
38 
39 public:
40  virtual ~TargetCursor(){};
41 
42  bool send_object_cursor( Network::Client* client,
44 
45  void cancel( Mobile::Character* chr );
46 
47 
48  void handle_target_cursor( Mobile::Character* targetter, PKTBI_6C* msg );
49  virtual void on_target_cursor( Mobile::Character* targetter, PKTBI_6C* msg ) = 0;
51 
52 protected:
54 };
55 
57 {
58  friend struct Cursors;
59 
60 protected:
61  FullMsgTargetCursor( void ( *func )( Mobile::Character*, PKTBI_6C* ) );
62 
63 public:
64  virtual ~FullMsgTargetCursor(){};
65 
66  virtual void on_target_cursor( Mobile::Character* targetter, PKTBI_6C* msg ) POL_OVERRIDE;
67 
68 private:
69  void ( *func )( Mobile::Character* targetter, PKTBI_6C* msg );
70 };
71 
72 
73 /******************************************************/
75 {
76  friend struct Cursors;
77 
78 protected:
79  LosCheckedTargetCursor( void ( *func )( Mobile::Character*, UObject* ),
80  bool inform_on_cancel = false );
81 
82 public:
84 
85  virtual void on_target_cursor( Mobile::Character*, PKTBI_6C* msg ) POL_OVERRIDE;
86 
87 private:
88  void ( *func )( Mobile::Character*, UObject* targetted );
89 };
90 /******************************************************/
91 
92 
93 /******************************************************/
95 {
96  friend struct Cursors;
97 
98 protected:
100  bool inform_on_cancel = false );
101 
102 public:
104 
105  virtual void on_target_cursor( Mobile::Character*, PKTBI_6C* msg ) POL_OVERRIDE;
106 
107 private:
108  void ( *func )( Mobile::Character*, UObject* targetted );
109 };
110 /******************************************************/
111 
112 
113 /******************************************************/
115 {
116  friend struct Cursors;
117 
118 protected:
119  LosCheckedCoordCursor( void ( *func )( Mobile::Character*, PKTBI_6C* msg ),
120  bool inform_on_cancel = false );
121 
122 public:
124 
125  bool send_coord_cursor( Network::Client* client );
126  virtual void on_target_cursor( Mobile::Character*, PKTBI_6C* msg ) POL_OVERRIDE;
127 
128 private:
129  void ( *func_ )( Mobile::Character*, PKTBI_6C* );
130 };
131 /*******************************************************/
132 
133 
134 /******************************************************/
136 {
137  friend struct Cursors;
138 
139 protected:
140  MultiPlacementCursor( void ( *func )( Mobile::Character*, PKTBI_6C* msg ) );
141 
142 public:
144 
145  void send_placemulti( Network::Client* client, unsigned int objtype, int flags, s16 xoffset,
146  s16 yoffset, u32 hue );
147  virtual void on_target_cursor( Mobile::Character*, PKTBI_6C* msg ) POL_OVERRIDE;
148 
149 private:
150  void ( *func_ )( Mobile::Character*, PKTBI_6C* );
151 };
152 /*******************************************************/
153 
154 
155 /******************************************************/
156 /* NoLosCharacterCursor - not used anymore */
158 {
159  friend struct Cursors;
160 
161 protected:
162  NoLosCharacterCursor( void ( *func )( Mobile::Character* targetter,
163  Mobile::Character* targetted ) );
164 
165 public:
167  virtual void on_target_cursor( Mobile::Character*, PKTBI_6C* msg ) POL_OVERRIDE;
168 
169 private:
170  void ( *func )( Mobile::Character* targetter, Mobile::Character* targetted );
171 };
172 /******************************************************/
173 
174 
175 /******************************************************/
177 {
178  friend struct Cursors;
179 
180 protected:
181  NoLosUObjectCursor( void ( *func )( Mobile::Character*, UObject* ),
182  bool inform_on_cancel = false );
183 
184 public:
185  virtual ~NoLosUObjectCursor(){};
186  virtual void on_target_cursor( Mobile::Character* chr, PKTBI_6C* msg ) POL_OVERRIDE;
187 
188 private:
189  void ( *func )( Mobile::Character*, UObject* obj );
190 };
191 /******************************************************/
192 
193 } // namespace Core
194 namespace Module
195 {
198 }
199 namespace Core
200 {
203 void handle_ident_cursor( Mobile::Character* chr, PKTBI_6C* msgin );
206 void show_repdata( Mobile::Character* looker, Mobile::Character* mob );
207 
208 struct Cursors
209 {
210 private:
211  // Every TargetCursor will be statically created once,
212  // and gets a id aka index in array to find the corresponding cursor
213  // from the client pkt. Sounds a bit wierd?
214  std::array<TargetCursor*, 10> _target_cursors;
216 
217  friend class TargetCursor;
218  friend void handle_target_cursor( Network::Client* client, PKTBI_6C* msg );
219  friend class GameState;
220 
221 protected:
222  Cursors();
223 
224 public:
227 
230 
234 
238 };
239 }
240 }
241 #endif
void handle_script_cursor(Character *chr, UObject *obj)
Definition: uomod.cpp:765
void handle_target_cursor(Network::Client *client, PKTBI_6C *msg)
Definition: target.cpp:37
FullMsgTargetCursor remove_member_cursor
Definition: target.h:229
#define POL_OVERRIDE
void start_packetlog(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:318
FullMsgTargetCursor ident_cursor
Definition: target.h:231
virtual ~FullMsgTargetCursor()
Definition: target.h:64
void stop_packetlog(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:369
void show_repdata(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:306
LosCheckedCoordCursor script_cursor2
Definition: target.h:232
LosCheckedTargetCursor los_checked_script_cursor
Definition: target.h:225
void handle_ident_cursor(Mobile::Character *chr, PKTBI_6C *msgin)
Definition: textcmd.cpp:213
FullMsgTargetCursor add_member_cursor
Definition: target.h:228
virtual ~TargetCursor()
Definition: target.h:40
unsigned int u32
Definition: rawtypes.h:27
signed short s16
Definition: rawtypes.h:30
NoLosCharacterCursor repdata_cursor
Definition: target.h:235
NoLosCheckedTargetCursor nolos_checked_script_cursor
Definition: target.h:226
void handle_add_member_cursor(Mobile::Character *chr, PKTBI_6C *msgin)
Definition: party.cpp:986
void handle_remove_member_cursor(Mobile::Character *chr, PKTBI_6C *msgin)
Definition: party.cpp:1009
NoLosCharacterCursor stoplog_cursor
Definition: target.h:237
NoLosCharacterCursor startlog_cursor
Definition: target.h:236
std::array< TargetCursor *, 10 > _target_cursors
Definition: target.h:214
MultiPlacementCursor multi_placement_cursor
Definition: target.h:233
Definition: berror.cpp:12
void handle_coord_cursor(Character *chr, PKTBI_6C *msg)
Definition: uomod.cpp:884