1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
… | |
… | |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | /* This file defines various flags that both the new client and |
24 | /* This file defines various flags that both the new client and |
25 | * newserver uses. These should never be changed, only expanded. |
25 | * newserver uses. These should never be changed, only expanded. |
26 | * Changing them will likely cause all old clients to not work properly. |
26 | * Changing them will likely cause all old clients to not work properly. |
… | |
… | |
200 | const void *ptr; |
200 | const void *ptr; |
201 | |
201 | |
202 | data (const void *ptr, int len) : len (len), ptr (ptr) { } |
202 | data (const void *ptr, int len) : len (len), ptr (ptr) { } |
203 | data (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
203 | data (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
204 | data (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
204 | data (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
|
|
205 | data (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { } |
205 | }; |
206 | }; |
206 | |
207 | |
207 | struct data8 |
208 | struct data8 |
208 | { |
209 | { |
209 | unsigned int len; |
210 | unsigned int len; |
210 | const void *ptr; |
211 | const void *ptr; |
211 | |
212 | |
212 | data8 (const void *ptr, int len) : len (len), ptr (ptr) { } |
213 | data8 (const void *ptr, int len) : len (len), ptr (ptr) { } |
213 | data8 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
214 | data8 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
214 | data8 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
215 | data8 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
|
|
216 | data8 (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { } |
215 | }; |
217 | }; |
216 | |
218 | |
217 | struct data16 |
219 | struct data16 |
218 | { |
220 | { |
219 | unsigned int len; |
221 | unsigned int len; |
220 | const void *ptr; |
222 | const void *ptr; |
221 | |
223 | |
222 | data16 (const void *ptr, int len) : len (len), ptr (ptr) { } |
224 | data16 (const void *ptr, int len) : len (len), ptr (ptr) { } |
223 | data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
225 | data16 (const char *str) : len (strlen (str ? str : 0)), ptr ((void *)str) { } |
224 | data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
226 | data16 (const shstr &sh) : len (sh.length ()), ptr ((void *)&sh) { } |
|
|
227 | data16 (dynbuf &buf) : len (buf.size ()), ptr (buf.linearise ()) { } |
225 | }; |
228 | }; |
226 | |
229 | |
227 | struct ber32 |
230 | struct ber32 |
228 | { |
231 | { |
229 | enum { size = 5 }; // maximum length of an encoded ber32 |
232 | enum { size = 5 }; // maximum length of an encoded ber32 |