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 |
… | |
… | |
40 | |
40 | |
41 | return 0; |
41 | return 0; |
42 | } |
42 | } |
43 | |
43 | |
44 | /* |
44 | /* |
45 | * returns true if the adressed object 'ob' is a player |
|
|
46 | * of the dragon race. |
|
|
47 | */ |
|
|
48 | int |
|
|
49 | is_dragon_pl (const object *op) |
|
|
50 | { |
|
|
51 | if (op |
|
|
52 | && op->type == PLAYER |
|
|
53 | && op->arch |
|
|
54 | && op->arch->race == shstr_dragon) |
|
|
55 | return 1; |
|
|
56 | |
|
|
57 | return 0; |
|
|
58 | } |
|
|
59 | |
|
|
60 | /* |
|
|
61 | * If final is set, it a clean/final save, not a backup, ie dont remove objects from inventory |
45 | * If final is set, it a clean/final save, not a backup, ie dont remove objects from inventory |
62 | */ |
46 | */ |
63 | bool |
47 | bool |
64 | player::save_pl (object_freezer &freezer) |
48 | player::save_pl (object_freezer &freezer) |
65 | { |
49 | { |
… | |
… | |
72 | ob->container = 0; |
56 | ob->container = 0; |
73 | |
57 | |
74 | if (ob->map) |
58 | if (ob->map) |
75 | maplevel = ob->map->path; |
59 | maplevel = ob->map->path; |
76 | |
60 | |
77 | #define PL_OUT(k) freezer.put (KW_ ## k, k) |
61 | #define PL_OUT(k) freezer.put (KW(k), k) |
78 | #define PL_OUT2(k,v) freezer.put (KW_ ## k, v) |
62 | #define PL_OUT2(k,v) freezer.put (KW(k), v) |
79 | |
63 | |
80 | PL_OUT (password); |
64 | PL_OUT (password); |
81 | PL_OUT2 (title, own_title); |
65 | PL_OUT2 (title, own_title); |
82 | PL_OUT (gender); |
66 | PL_OUT (gender); |
83 | PL_OUT (hintmode); |
67 | PL_OUT (hintmode); |
… | |
… | |
90 | PL_OUT (digestion); |
74 | PL_OUT (digestion); |
91 | PL_OUT2 (pickup, mode); |
75 | PL_OUT2 (pickup, mode); |
92 | PL_OUT (outputs_sync); |
76 | PL_OUT (outputs_sync); |
93 | PL_OUT (outputs_count); |
77 | PL_OUT (outputs_count); |
94 | |
78 | |
95 | freezer.put (KW_usekeys, usekeys == key_inventory ? "key_inventory" : (usekeys == keyrings ? "keyrings" : "containers")); |
79 | freezer.put (KW(usekeys), usekeys == key_inventory ? CS(key_inventory) : (usekeys == keyrings ? CS(keyrings) : CS(containers))); |
96 | freezer.put (KW_unapply, unapply == unapply_nochoice ? "unapply_nochoice" : (unapply == unapply_never ? "unapply_never" : "unapply_always")); |
80 | freezer.put (KW(unapply), unapply == unapply_nochoice ? CS(unapply_nochoice) : (unapply == unapply_never ? CS(unapply_never) : CS(unapply_always))); |
97 | |
81 | |
98 | PL_OUT2 (map, maplevel); |
82 | PL_OUT2 (map, maplevel); |
99 | PL_OUT (savebed_map); |
83 | PL_OUT (savebed_map); |
100 | PL_OUT (bed_x); |
84 | PL_OUT (bed_x); |
101 | PL_OUT (bed_y); |
85 | PL_OUT (bed_y); |
… | |
… | |
117 | freezer.add (levsp [i]); freezer.add ('\n'); |
101 | freezer.add (levsp [i]); freezer.add ('\n'); |
118 | freezer.add (levgrace[i]); freezer.add ('\n'); |
102 | freezer.add (levgrace[i]); freezer.add ('\n'); |
119 | } |
103 | } |
120 | |
104 | |
121 | freezer.put (ob->contr); |
105 | freezer.put (ob->contr); |
122 | freezer.put (KW_endplst); |
106 | freezer.put (KW(endplst)); |
123 | |
107 | |
124 | CLEAR_FLAG (ob, FLAG_WIZ); |
108 | CLEAR_FLAG (ob, FLAG_WIZ); |
125 | ob->write (freezer); |
109 | ob->write (freezer); |
126 | |
110 | |
127 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
111 | /* Eneq(@csd.uu.se): Reveal the container if we have one. */ |
… | |
… | |
267 | pl->destroy (); |
251 | pl->destroy (); |
268 | |
252 | |
269 | return 0; |
253 | return 0; |
270 | } |
254 | } |
271 | |
255 | |
272 | const char * |
256 | const_utf8_string |
273 | player::killer_name () const |
257 | player::killer_name () const |
274 | { |
258 | { |
275 | static char buf [2048]; |
259 | static char buf [2048]; |
276 | |
260 | |
277 | if (!killer) |
261 | if (!killer) |