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 | |
… | |
… | |
131 | |
134 | |
132 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
135 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
133 | |
136 | |
134 | return true; |
137 | return true; |
135 | } |
138 | } |
|
|
139 | |
|
|
140 | //-GPL |
136 | |
141 | |
137 | bool |
142 | bool |
138 | player::save_pl (const char *path) |
143 | player::save_pl (const char *path) |
139 | { |
144 | { |
140 | object_freezer freezer; |
145 | object_freezer freezer; |
… | |
… | |
337 | buf << "<"; |
342 | buf << "<"; |
338 | break; |
343 | break; |
339 | |
344 | |
340 | case '\r': |
345 | case '\r': |
341 | buf << '\n'; |
346 | buf << '\n'; |
|
|
347 | /* \r\n+ becomes one or more newlines */ |
|
|
348 | while (*cfpod == '\n') |
|
|
349 | buf << *cfpod++; |
342 | break; |
350 | break; |
343 | |
351 | |
344 | case '\n': |
352 | case '\n': |
345 | if (end == -2) |
353 | if (end == -2) |
346 | return cfpod; |
354 | return cfpod; |
… | |
… | |
355 | --cfpod; |
363 | --cfpod; |
356 | do |
364 | do |
357 | buf << *cfpod++; |
365 | buf << *cfpod++; |
358 | while (*cfpod == '\n'); |
366 | while (*cfpod == '\n'); |
359 | } |
367 | } |
360 | else if (*cfpod != ' ') |
368 | else if (*cfpod == ' ') |
|
|
369 | buf << '\n'; |
|
|
370 | else |
361 | buf << ' '; |
371 | buf << ' '; |
362 | |
372 | |
363 | // verbatim block? |
373 | // verbatim block? |
364 | if (*cfpod == ' ') |
374 | if (*cfpod == ' ') |
365 | goto verbatim; |
375 | goto verbatim; |
… | |
… | |
394 | case 'C': pfx = "<tt>" ; sfx = "</tt>" ; break; |
404 | case 'C': pfx = "<tt>" ; sfx = "</tt>" ; break; |
395 | case 'E': pfx = "&" ; sfx = ";" ; break; |
405 | case 'E': pfx = "&" ; sfx = ";" ; break; |
396 | case 'I': pfx = "<i>" ; sfx = "</i>" ; break; |
406 | case 'I': pfx = "<i>" ; sfx = "</i>" ; break; |
397 | case 'U': pfx = "<u>" ; sfx = "</u>" ; break; |
407 | case 'U': pfx = "<u>" ; sfx = "</u>" ; break; |
398 | case 'T': pfx = "<big><b>"; sfx = "</b></big>"; break; |
408 | case 'T': pfx = "<big><b>"; sfx = "</b></big>"; break; |
|
|
409 | case 'Z': pfx = "" ; sfx = "" ; break; |
399 | |
410 | |
400 | case 'H': // hint |
411 | case 'H': // hint |
401 | { |
412 | { |
402 | if (pl->hintmode) |
413 | if (pl->hintmode) |
403 | { |
414 | { |
404 | cfpod = expand_cfpod (pl, nest, cfpod, end); |
415 | cfpod = expand_cfpod (pl, nest, cfpod, end); |
405 | nest.clear (); |
416 | nest.clear (); |
406 | |
417 | |
407 | if (pl->hintmode == 1) |
418 | if (pl->hintmode == 1) |
408 | buf << "<fg name=\"lightblue\">[Hint suppressed, see hintmode]</fg>"; |
419 | buf << "<fg name=\"lightblue\">[Hint available]</fg>"; |
409 | else |
420 | else |
410 | while (*cfpod == ' ') // eat trailing whitespace |
421 | while (*cfpod <= ' '&& *cfpod) // eat trailing whitespace |
411 | ++cfpod; |
422 | ++cfpod; |
412 | |
423 | |
413 | goto skip; |
424 | goto skip; |
414 | } |
425 | } |
415 | else |
426 | else |
416 | { |
427 | { |
417 | pfx = "<fg name=\"lightblue\">["; |
428 | pfx = "<fg name=\"lightblue\">[Hint: "; |
418 | sfx = " (Use hintmode to suppress hints)]</fg>"; |
429 | sfx = "]</fg>"; |
419 | } |
430 | } |
420 | } |
431 | } |
421 | break; |
432 | break; |
422 | |
433 | |
423 | case 'G': // gender |
434 | case 'G': // gender |
… | |
… | |
438 | |
449 | |
439 | nest.clear (); |
450 | nest.clear (); |
440 | |
451 | |
441 | goto skip; |
452 | goto skip; |
442 | } |
453 | } |
|
|
454 | |
|
|
455 | default: |
|
|
456 | pfx = "UNKNOWN_DIRECTIVE{"; |
|
|
457 | sfx = "}"; |
|
|
458 | break; |
443 | } |
459 | } |
444 | |
460 | |
445 | buf << pfx; |
461 | buf << pfx; |
446 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
462 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
447 | buf << sfx; |
463 | buf << sfx; |