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.7 by root, Wed Dec 13 18:08:01 2006 UTC vs.
Revision 1.8 by root, Wed Dec 13 18:51:50 2006 UTC

255}; 255};
256 256
257/* 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. */
258struct SockList 258struct SockList
259{ 259{
260 uint8 *buf;
261 int len;
262
263// SockList () buf (0), len (0) { } 260 SockList () : buf (0), len (0) { }
264// SockList (int size) buf (malloc (size)), len (0) { } 261 SockList (int size) : buf ((uint8 *)malloc (size)), len (0) { }
262
263 int length () const { return len; }
265 264
266 SockList &operator <<(uint8 v) { buf [len++] = v; return *this; } 265 SockList &operator <<(uint8 v) { buf [len++] = v; return *this; }
267 266
268 SockList &operator <<(uint16 v) { return *this << uint8 (v >> 8) << uint8 (v); } 267 SockList &operator <<(uint16 v) { return *this << uint8 (v >> 8) << uint8 (v); }
269 SockList &operator <<(uint32 v) { return *this << uint16 (v >> 16) << uint16 (v); } 268 SockList &operator <<(uint32 v) { return *this << uint16 (v >> 16) << uint16 (v); }
274 SockList &operator <<(sint32 v) { return *this << (uint32)v; } 273 SockList &operator <<(sint32 v) { return *this << (uint32)v; }
275 SockList &operator <<(sint64 v) { return *this << (uint64)v; } 274 SockList &operator <<(sint64 v) { return *this << (uint64)v; }
276 275
277 SockList &operator <<(const data8 &v); 276 SockList &operator <<(const data8 &v);
278 SockList &operator <<(const data16 &v); 277 SockList &operator <<(const data16 &v);
278
279 SockList &operator <<(const char *v);
280
281 void free () { ::free (buf); }
282
283public:
284 uint8 *buf;
285 int len;
279}; 286};
280 287
281inline void SockList_AddChar (SockList *sl, uint8 data) { *sl << data; } 288inline void SockList_AddChar (SockList *sl, uint8 data) { *sl << data; }
282inline void SockList_AddShort(SockList *sl, uint16 data) { *sl << data; } 289inline void SockList_AddShort(SockList *sl, uint16 data) { *sl << data; }
283inline void SockList_AddInt (SockList *sl, uint32 data) { *sl << data; } 290inline void SockList_AddInt (SockList *sl, uint32 data) { *sl << data; }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines