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.13 by root, Thu Dec 14 01:21:58 2006 UTC vs.
Revision 1.14 by root, Thu Dec 14 01:30:52 2006 UTC

265}; 265};
266 266
267/* 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. */
268struct packet 268struct packet
269{ 269{
270 packet () : buf ((uint8 *)malloc (MAXSOCKBUF)), len (0) { } 270 packet () : len (0) { }
271 ~packet () { free (buf); }
272 271
273 void reset () { len = 0; } 272 void reset () { len = 0; }
274 int length () const { return len; } 273 int length () const { return len; }
275 274
276 packet &operator <<(uint8 v) { buf [len++] = v; return *this; } 275 packet &operator <<(uint8 v) { buf [len++] = v; return *this; }
292 packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); } 291 packet &operator <<(const shstr &sh) { return *this << data (&sh, sh.length ()); }
293 292
294 void printf (const char *format, ...); 293 void printf (const char *format, ...);
295 294
296public: 295public:
297 uint8 *buf; 296 uint8 buf [MAXSOCKBUF];
298 int len; 297 int len;
299}; 298};
300 299
301inline uint16 net_uint16 (uint8 *data) { return (data [0] << 8) | data [1]; } 300inline uint16 net_uint16 (uint8 *data) { return (data [0] << 8) | data [1]; }
302inline uint32 net_uint32 (uint8 *data) { return (net_uint16 (data) << 16) | net_uint16 (data + 2); } 301inline uint32 net_uint32 (uint8 *data) { return (net_uint16 (data) << 16) | net_uint16 (data + 2); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines