ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/newclient.h
(Generate patch)

Comparing deliantra/server/include/newclient.h (file contents):
Revision 1.8 by root, Wed Dec 13 18:51:50 2006 UTC vs.
Revision 1.9 by root, Wed Dec 13 21:27:09 2006 UTC

232#define UPD_SP_DAMAGE 0x04 232#define UPD_SP_DAMAGE 0x04
233 233
234#define SOUND_NORMAL 0 234#define SOUND_NORMAL 0
235#define SOUND_SPELL 1 235#define SOUND_SPELL 1
236 236
237struct data
238{
239 const void *ptr;
240 unsigned int len;
241
242 data (const void *ptr, int len) : len (len), ptr (ptr) { }
243 data (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
244 data (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { }
245};
246
237struct data8 247struct data8
238{ 248{
239 void *data; 249 const void *ptr;
240 int len; 250 unsigned int len;
241 251
242 data8 (int len, void *data) : len (len), data (data) { } 252 data8 (const void *ptr, int len) : len (len), ptr (ptr) { }
243 data8 (const char *str) : len (strlen (str ? str : 0)), data ((void *)str) { } 253 data8 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
244 data8 (const shstr &sh) : len (sh.length ()), data ((void *)&sh) { } 254 data8 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { }
245}; 255};
246 256
247struct data16 257struct data16
248{ 258{
249 void *data; 259 const void *ptr;
250 int len; 260 unsigned int len;
251 261
252 data16 (int len, void *data) : len (len), data (data) { } 262 data16 (const void *ptr, int len) : len (len), ptr (ptr) { }
253 data16 (const char *str) : len (strlen (str ? str : 0)), data ((void *)str) { } 263 data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { }
254 data16 (const shstr &sh) : len (sh.length ()), data ((void *)&sh) { } 264 data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { }
255}; 265};
256 266
257/* Contains the base information we use to make up a packet we want to send. */ 267/* Contains the base information we use to make up a packet we want to send. */
258struct SockList 268struct SockList
259{ 269{
271 SockList &operator <<(sint8 v) { return *this << (uint8 )v; } 281 SockList &operator <<(sint8 v) { return *this << (uint8 )v; }
272 SockList &operator <<(sint16 v) { return *this << (uint16)v; } 282 SockList &operator <<(sint16 v) { return *this << (uint16)v; }
273 SockList &operator <<(sint32 v) { return *this << (uint32)v; } 283 SockList &operator <<(sint32 v) { return *this << (uint32)v; }
274 SockList &operator <<(sint64 v) { return *this << (uint64)v; } 284 SockList &operator <<(sint64 v) { return *this << (uint64)v; }
275 285
286 SockList &operator <<(const data &v);
276 SockList &operator <<(const data8 &v); 287 SockList &operator <<(const data8 &v);
277 SockList &operator <<(const data16 &v); 288 SockList &operator <<(const data16 &v);
278 289
279 SockList &operator <<(const char *v); 290 SockList &operator <<(const char *v);
291 SockList &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); }
292
293 void printf (const char *format, ...);
280 294
281 void free () { ::free (buf); } 295 void free () { ::free (buf); }
282 296
283public: 297public:
284 uint8 *buf; 298 uint8 *buf;
285 int len; 299 int len;
286}; 300};
287 301
288inline void SockList_AddChar (SockList *sl, uint8 data) { *sl << data; } 302inline void SockList_AddChar (SockList *sl, uint8 data) { *sl << data; }
289inline void SockList_AddShort(SockList *sl, uint16 data) { *sl << data; } 303inline void SockList_AddShort (SockList *sl, uint16 data) { *sl << data; }
290inline void SockList_AddInt (SockList *sl, uint32 data) { *sl << data; } 304inline void SockList_AddInt (SockList *sl, uint32 data) { *sl << data; }
291inline void SockList_AddInt64(SockList *sl, uint64 data) { *sl << data; } 305inline void SockList_AddInt64 (SockList *sl, uint64 data) { *sl << data; }
292 306
293struct CS_Stats 307struct CS_Stats
294{ 308{
295 int ibytes; /* ibytes, obytes are bytes in, out */ 309 int ibytes; /* ibytes, obytes are bytes in, out */
296 int obytes; 310 int obytes;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines