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,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 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 it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
22 | * 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> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | |
26 | |
|
|
27 | //+GPL |
|
|
28 | |
27 | /* Determine if the attacktype represented by the |
29 | /* Determine if the attacktype represented by the |
28 | * specified attack-number is enabled for dragon players. |
30 | * specified attack-number is enabled for dragon players. |
29 | * A dragon player (quetzal) can gain resistances for |
31 | * A dragon player (quetzal) can gain resistances for |
30 | * all enabled attacktypes. |
32 | * all enabled attacktypes. |
31 | */ |
33 | */ |
… | |
… | |
70 | ob->container = 0; |
72 | ob->container = 0; |
71 | |
73 | |
72 | if (ob->map) |
74 | if (ob->map) |
73 | maplevel = ob->map->path; |
75 | maplevel = ob->map->path; |
74 | |
76 | |
75 | #define PL_OUT(k) freezer.put (KW_ ## k, k) |
77 | #define PL_OUT(k) freezer.put (KW(k), k) |
76 | #define PL_OUT2(k,v) freezer.put (KW_ ## k, v) |
78 | #define PL_OUT2(k,v) freezer.put (KW(k), v) |
77 | |
79 | |
78 | PL_OUT (password); |
80 | PL_OUT (password); |
79 | PL_OUT2 (title, own_title); |
81 | PL_OUT2 (title, own_title); |
80 | PL_OUT (gender); |
82 | PL_OUT (gender); |
81 | PL_OUT (hintmode); |
83 | PL_OUT (hintmode); |
… | |
… | |
88 | PL_OUT (digestion); |
90 | PL_OUT (digestion); |
89 | PL_OUT2 (pickup, mode); |
91 | PL_OUT2 (pickup, mode); |
90 | PL_OUT (outputs_sync); |
92 | PL_OUT (outputs_sync); |
91 | PL_OUT (outputs_count); |
93 | PL_OUT (outputs_count); |
92 | |
94 | |
93 | freezer.put (KW_usekeys, usekeys == key_inventory ? "key_inventory" : (usekeys == keyrings ? "keyrings" : "containers")); |
95 | freezer.put (KW(usekeys), usekeys == key_inventory ? CS(key_inventory) : (usekeys == keyrings ? CS(keyrings) : CS(containers))); |
94 | freezer.put (KW_unapply, unapply == unapply_nochoice ? "unapply_nochoice" : (unapply == unapply_never ? "unapply_never" : "unapply_always")); |
96 | freezer.put (KW(unapply), unapply == unapply_nochoice ? CS(unapply_nochoice) : (unapply == unapply_never ? CS(unapply_never) : CS(unapply_always))); |
95 | |
97 | |
96 | PL_OUT2 (map, maplevel); |
98 | PL_OUT2 (map, maplevel); |
97 | PL_OUT (savebed_map); |
99 | PL_OUT (savebed_map); |
98 | PL_OUT (bed_x); |
100 | PL_OUT (bed_x); |
99 | PL_OUT (bed_y); |
101 | PL_OUT (bed_y); |
… | |
… | |
115 | freezer.add (levsp [i]); freezer.add ('\n'); |
117 | freezer.add (levsp [i]); freezer.add ('\n'); |
116 | freezer.add (levgrace[i]); freezer.add ('\n'); |
118 | freezer.add (levgrace[i]); freezer.add ('\n'); |
117 | } |
119 | } |
118 | |
120 | |
119 | freezer.put (ob->contr); |
121 | freezer.put (ob->contr); |
120 | freezer.put (KW_endplst); |
122 | freezer.put (KW(endplst)); |
121 | |
123 | |
122 | SET_FLAG (ob, FLAG_NO_FIX_PLAYER); |
|
|
123 | CLEAR_FLAG (ob, FLAG_WIZ); |
124 | CLEAR_FLAG (ob, FLAG_WIZ); |
124 | ob->write (freezer); |
125 | ob->write (freezer); |
125 | |
126 | |
126 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
|
|
127 | |
|
|
128 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
127 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
129 | ob->container = container; |
128 | ob->container = container; |
130 | |
129 | |
131 | ob->flag [FLAG_WIZ] = wiz; |
130 | ob->flag [FLAG_WIZ] = wiz; |
132 | |
131 | |
133 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
132 | INVOKE_PLAYER (SAVE_DONE, ob->contr); |
134 | |
133 | |
135 | return true; |
134 | return true; |
136 | } |
135 | } |
|
|
136 | |
|
|
137 | //-GPL |
137 | |
138 | |
138 | bool |
139 | bool |
139 | player::save_pl (const char *path) |
140 | player::save_pl (const char *path) |
140 | { |
141 | { |
141 | object_freezer freezer; |
142 | object_freezer freezer; |
… | |
… | |
266 | pl->destroy (); |
267 | pl->destroy (); |
267 | |
268 | |
268 | return 0; |
269 | return 0; |
269 | } |
270 | } |
270 | |
271 | |
271 | const char * |
272 | const_utf8_string |
272 | player::killer_name () const |
273 | player::killer_name () const |
273 | { |
274 | { |
274 | static char buf [2048]; |
275 | static char buf [2048]; |
275 | |
276 | |
276 | if (!killer) |
277 | if (!killer) |
… | |
… | |
445 | |
446 | |
446 | nest.clear (); |
447 | nest.clear (); |
447 | |
448 | |
448 | goto skip; |
449 | goto skip; |
449 | } |
450 | } |
|
|
451 | |
|
|
452 | default: |
|
|
453 | pfx = "UNKNOWN_DIRECTIVE{"; |
|
|
454 | sfx = "}"; |
|
|
455 | break; |
450 | } |
456 | } |
451 | |
457 | |
452 | buf << pfx; |
458 | buf << pfx; |
453 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
459 | cfpod = expand_cfpod (pl, buf, cfpod, end); |
454 | buf << sfx; |
460 | buf << sfx; |