1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009 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 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * 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, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | #include <global.h> |
25 | #include <global.h> |
|
|
26 | |
|
|
27 | //+GPL |
25 | |
28 | |
26 | /* Determine if the attacktype represented by the |
29 | /* Determine if the attacktype represented by the |
27 | * specified attack-number is enabled for dragon players. |
30 | * specified attack-number is enabled for dragon players. |
28 | * A dragon player (quetzal) can gain resistances for |
31 | * A dragon player (quetzal) can gain resistances for |
29 | * all enabled attacktypes. |
32 | * all enabled attacktypes. |
… | |
… | |
63 | INVOKE_PLAYER (SAVE, ob->contr); |
66 | INVOKE_PLAYER (SAVE, ob->contr); |
64 | |
67 | |
65 | int wiz = ob->flag [FLAG_WIZ]; |
68 | int wiz = ob->flag [FLAG_WIZ]; |
66 | |
69 | |
67 | /* Eneq(@csd.uu.se): If we have an open container hide it. */ |
70 | /* Eneq(@csd.uu.se): If we have an open container hide it. */ |
68 | object *container = ob->container; |
71 | object *container = ob->container_ (); |
69 | ob->container = 0; |
72 | ob->container = 0; |
70 | |
73 | |
71 | if (ob->map) |
74 | if (ob->map) |
72 | maplevel = ob->map->path; |
75 | maplevel = ob->map->path; |
73 | |
76 | |
… | |
… | |
116 | } |
119 | } |
117 | |
120 | |
118 | freezer.put (ob->contr); |
121 | freezer.put (ob->contr); |
119 | freezer.put (KW_endplst); |
122 | freezer.put (KW_endplst); |
120 | |
123 | |
121 | SET_FLAG (ob, FLAG_NO_FIX_PLAYER); |
|
|
122 | CLEAR_FLAG (ob, FLAG_WIZ); |
124 | CLEAR_FLAG (ob, FLAG_WIZ); |
123 | ob->write (freezer); |
125 | ob->write (freezer); |
124 | |
126 | |
125 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
|
|
126 | |
|
|
127 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
127 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
128 | ob->container = container; |
128 | ob->container = container; |
129 | |
129 | |
130 | ob->flag [FLAG_WIZ] = wiz; |
130 | ob->flag [FLAG_WIZ] = wiz; |
131 | |
131 | |
132 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
132 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
133 | |
133 | |
134 | return true; |
134 | return true; |
135 | } |
135 | } |
|
|
136 | |
|
|
137 | //-GPL |
136 | |
138 | |
137 | bool |
139 | bool |
138 | player::save_pl (const char *path) |
140 | player::save_pl (const char *path) |
139 | { |
141 | { |
140 | object_freezer freezer; |
142 | object_freezer freezer; |
… | |
… | |
337 | buf << "<"; |
339 | buf << "<"; |
338 | break; |
340 | break; |
339 | |
341 | |
340 | case '\r': |
342 | case '\r': |
341 | buf << '\n'; |
343 | buf << '\n'; |
|
|
344 | /* \r\n+ becomes one or more newlines */ |
|
|
345 | while (*cfpod == '\n') |
|
|
346 | buf << *cfpod++; |
342 | break; |
347 | break; |
343 | |
348 | |
344 | case '\n': |
349 | case '\n': |
345 | if (end == -2) |
350 | if (end == -2) |
346 | return cfpod; |
351 | return cfpod; |
… | |
… | |
406 | { |
411 | { |
407 | cfpod = expand_cfpod (pl, nest, cfpod, end); |
412 | cfpod = expand_cfpod (pl, nest, cfpod, end); |
408 | nest.clear (); |
413 | nest.clear (); |
409 | |
414 | |
410 | if (pl->hintmode == 1) |
415 | if (pl->hintmode == 1) |
411 | buf << "<fg name=\"lightblue\">[Hint suppressed, see hintmode]</fg>"; |
416 | buf << "<fg name=\"lightblue\">[Hint available]</fg>"; |
412 | else |
417 | else |
413 | while (*cfpod == ' ') // eat trailing whitespace |
418 | while (*cfpod <= ' '&& *cfpod) // eat trailing whitespace |
414 | ++cfpod; |
419 | ++cfpod; |
415 | |
420 | |
416 | goto skip; |
421 | goto skip; |
417 | } |
422 | } |
418 | else |
423 | else |
419 | { |
424 | { |
420 | pfx = "<fg name=\"lightblue\">["; |
425 | pfx = "<fg name=\"lightblue\">[Hint: "; |
421 | sfx = " (Use hintmode to suppress hints)]</fg>"; |
426 | sfx = "]</fg>"; |
422 | } |
427 | } |
423 | } |
428 | } |
424 | break; |
429 | break; |
425 | |
430 | |
426 | case 'G': // gender |
431 | case 'G': // gender |
… | |
… | |
441 | |
446 | |
442 | nest.clear (); |
447 | nest.clear (); |
443 | |
448 | |
444 | goto skip; |
449 | goto skip; |
445 | } |
450 | } |
|
|
451 | |
|
|
452 | default: |
|
|
453 | pfx = "UNKNOWN_DIRECTIVE{"; |
|
|
454 | sfx = "}"; |
|
|
455 | break; |
446 | } |
456 | } |
447 | |
457 | |
448 | buf << pfx; |
458 | buf << pfx; |
449 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
459 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
450 | buf << sfx; |
460 | buf << sfx; |