1 | /* |
|
|
2 | * static char *rcsid_newclient_h = |
|
|
3 | * "$Id: newclient.h,v 1.4 2006/08/18 02:06:57 root Exp $"; |
|
|
4 | */ |
|
|
5 | |
|
|
6 | /* |
1 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
8 | |
3 | |
9 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
10 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
177 | #define NDI_ORANGE 4 |
172 | #define NDI_ORANGE 4 |
178 | #define NDI_BLUE 5 /* Actually, it is Dodger Blue */ |
173 | #define NDI_BLUE 5 /* Actually, it is Dodger Blue */ |
179 | #define NDI_DK_ORANGE 6 /* DarkOrange2 */ |
174 | #define NDI_DK_ORANGE 6 /* DarkOrange2 */ |
180 | #define NDI_GREEN 7 /* SeaGreen */ |
175 | #define NDI_GREEN 7 /* SeaGreen */ |
181 | #define NDI_LT_GREEN 8 /* DarkSeaGreen, which is actually paler */ |
176 | #define NDI_LT_GREEN 8 /* DarkSeaGreen, which is actually paler */ |
182 | /* Than seagreen - also background color */ |
177 | /* Than seagreen - also background color */ |
183 | #define NDI_GREY 9 |
178 | #define NDI_GREY 9 |
184 | #define NDI_BROWN 10 /* Sienna */ |
179 | #define NDI_BROWN 10 /* Sienna */ |
185 | #define NDI_GOLD 11 |
180 | #define NDI_GOLD 11 |
186 | #define NDI_TAN 12 /* Khaki */ |
181 | #define NDI_TAN 12 /* Khaki */ |
187 | |
182 | |
188 | #define NDI_MAX_COLOR 12 /* Last value in */ |
183 | #define NDI_MAX_COLOR 12 /* Last value in */ |
189 | #define NDI_COLOR_MASK 0xff /* Gives lots of room for expansion - we are */ |
184 | #define NDI_COLOR_MASK 0xff /* Gives lots of room for expansion - we are */ |
190 | /* using an int anyways, so we have the space */ |
185 | /* using an int anyways, so we have the space */ |
191 | /* to still do all the flags */ |
186 | /* to still do all the flags */ |
192 | |
187 | |
193 | |
188 | |
194 | #define NDI_UNIQUE 0x100 /* Print this out immediately, don't buffer */ |
189 | #define NDI_UNIQUE 0x100 /* Print this out immediately, don't buffer */ |
195 | #define NDI_ALL 0x200 /* Inform all players of this message */ |
190 | #define NDI_ALL 0x200 /* Inform all players of this message */ |
196 | |
191 | |
… | |
… | |
216 | * are color informatin. For now, only high bit information we need |
211 | * are color informatin. For now, only high bit information we need |
217 | * is floor information. |
212 | * is floor information. |
218 | */ |
213 | */ |
219 | #define FACE_FLOOR 0x80 |
214 | #define FACE_FLOOR 0x80 |
220 | #define FACE_WALL 0x40 /* Or'd into the color value by the server |
215 | #define FACE_WALL 0x40 /* Or'd into the color value by the server |
221 | * right before sending. |
216 | * right before sending. |
222 | */ |
217 | */ |
223 | #define FACE_COLOR_MASK 0xf |
218 | #define FACE_COLOR_MASK 0xf |
224 | |
219 | |
225 | #define UPD_LOCATION 0x01 |
220 | #define UPD_LOCATION 0x01 |
226 | #define UPD_FLAGS 0x02 |
221 | #define UPD_FLAGS 0x02 |
227 | #define UPD_WEIGHT 0x04 |
222 | #define UPD_WEIGHT 0x04 |
… | |
… | |
237 | #define UPD_SP_DAMAGE 0x04 |
232 | #define UPD_SP_DAMAGE 0x04 |
238 | |
233 | |
239 | #define SOUND_NORMAL 0 |
234 | #define SOUND_NORMAL 0 |
240 | #define SOUND_SPELL 1 |
235 | #define SOUND_SPELL 1 |
241 | |
236 | |
|
|
237 | struct data8 |
|
|
238 | { |
|
|
239 | void *data; |
|
|
240 | int len; |
|
|
241 | |
|
|
242 | data8 (int len, void *data) : len (len), data (data) { } |
|
|
243 | data8 (const char *str) : len (strlen (str ? str : 0)), data ((void *)str) { } |
|
|
244 | data8 (const shstr &sh) : len (sh.length ()), data ((void *)&sh) { } |
|
|
245 | }; |
|
|
246 | |
|
|
247 | struct data16 |
|
|
248 | { |
|
|
249 | void *data; |
|
|
250 | int len; |
|
|
251 | |
|
|
252 | data16 (int len, void *data) : len (len), data (data) { } |
|
|
253 | data16 (const char *str) : len (strlen (str ? str : 0)), data ((void *)str) { } |
|
|
254 | data16 (const shstr &sh) : len (sh.length ()), data ((void *)&sh) { } |
|
|
255 | }; |
|
|
256 | |
242 | /* Contains the base information we use to make up a packet we want to send. */ |
257 | /* Contains the base information we use to make up a packet we want to send. */ |
243 | struct SockList { |
258 | struct SockList |
|
|
259 | { |
|
|
260 | uint8 *buf; |
244 | int len; |
261 | int len; |
245 | unsigned char *buf; |
|
|
246 | }; |
|
|
247 | |
262 | |
248 | inline void SockList_AddChar (SockList *sl, char c) |
263 | // SockList () buf (0), len (0) { } |
249 | { |
264 | // SockList (int size) buf (malloc (size)), len (0) { } |
250 | sl->buf[sl->len++]=c; |
|
|
251 | } |
|
|
252 | |
265 | |
|
|
266 | SockList &operator <<(uint8 v) { buf [len++] = v; return *this; } |
|
|
267 | |
|
|
268 | SockList &operator <<(uint16 v) { return *this << uint8 (v >> 8) << uint8 (v); } |
|
|
269 | SockList &operator <<(uint32 v) { return *this << uint16 (v >> 16) << uint16 (v); } |
|
|
270 | SockList &operator <<(uint64 v) { return *this << uint32 (v >> 32) << uint32 (v); } |
|
|
271 | |
|
|
272 | SockList &operator <<(sint8 v) { return *this << (uint8 )v; } |
|
|
273 | SockList &operator <<(sint16 v) { return *this << (uint16)v; } |
|
|
274 | SockList &operator <<(sint32 v) { return *this << (uint32)v; } |
|
|
275 | SockList &operator <<(sint64 v) { return *this << (uint64)v; } |
|
|
276 | |
|
|
277 | SockList &operator <<(const data8 &v); |
|
|
278 | SockList &operator <<(const data16 &v); |
|
|
279 | }; |
|
|
280 | |
|
|
281 | inline void SockList_AddChar (SockList *sl, uint8 data) { *sl << data; } |
253 | inline void SockList_AddShort (SockList *sl, unsigned short data) |
282 | inline void SockList_AddShort(SockList *sl, uint16 data) { *sl << data; } |
254 | { |
283 | inline void SockList_AddInt (SockList *sl, uint32 data) { *sl << data; } |
255 | sl->buf[sl->len++] = data >> 8; |
284 | inline void SockList_AddInt64(SockList *sl, uint64 data) { *sl << data; } |
256 | sl->buf[sl->len++] = data; |
|
|
257 | } |
|
|
258 | |
285 | |
259 | struct CS_Stats { |
286 | struct CS_Stats |
|
|
287 | { |
260 | int ibytes; /* ibytes, obytes are bytes in, out */ |
288 | int ibytes; /* ibytes, obytes are bytes in, out */ |
261 | int obytes; |
289 | int obytes; |
262 | short max_conn; /* Maximum connections received */ |
290 | short max_conn; /* Maximum connections received */ |
263 | time_t time_start; /* When we started logging this */ |
291 | time_t time_start; /* When we started logging this */ |
264 | }; |
292 | }; |
265 | |
293 | |
266 | extern CS_Stats cst_tot, cst_lst; |
294 | extern CS_Stats cst_tot, cst_lst; |
267 | |
295 | |
268 | #endif |
296 | #endif |
|
|
297 | |