ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/resurrection.C
(Generate patch)

Comparing deliantra/server/server/resurrection.C (file contents):
Revision 1.16 by elmex, Wed Jan 3 02:30:52 2007 UTC vs.
Revision 1.22 by root, Mon Jun 4 12:19:09 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * Crossfire TRT is free software; you can redistribute it and/or modify it
8 it under the terms of the GNU General Public License as published by 9 * under the terms of the GNU General Public License as published by the Free
9 the Free Software Foundation; either version 2 of the License, or 10 * Software Foundation; either version 2 of the License, or (at your option)
10 (at your option) any later version. 11 * any later version.
11 12 *
12 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, but
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 GNU General Public License for more details. 16 * for more details.
16 17 *
17 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 along
18 along with this program; if not, write to the Free Software 19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 21 *
21 The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
22*/ 23 */
23 24
24/* the contents of this file were create solely by peterm@soda.berkeley.edu 25/* the contents of this file were create solely by peterm@soda.berkeley.edu
25 all of the above disclaimers apply. */ 26 all of the above disclaimers apply. */
26 27
27#include <global.h> 28#include <global.h>
28#include <sproto.h> 29#include <sproto.h>
29#include <spells.h> 30#include <spells.h>
30#include <errno.h> 31#include <errno.h>
31
32extern char **classname;
33extern object *objects;
34 32
35/* name of the person to resurrect and which spell was used 33/* name of the person to resurrect and which spell was used
36 * to resurrect 34 * to resurrect
37 */ 35 */
38static int 36static int
50 int Con; 48 int Con;
51 49
52 /* reincarnation, which changes the race */ 50 /* reincarnation, which changes the race */
53 if (spell->race) 51 if (spell->race)
54 { 52 {
55 treasurelist *tl = find_treasurelist (spell->race); 53 treasurelist *tl = treasurelist::find (spell->race);
56 treasure *t; 54 treasure *t;
57 int value; 55 int value;
58 56
59 if (!tl) 57 if (!tl)
60 { 58 {
61 LOG (llevError, "resurrect_player: race set to %s, but no treasurelist of that name!\n", &spell->race); 59 LOG (llevError, "resurrect_player: race set to %s, but no treasurelist of that name!\n", &spell->race);
62 return 0; 60 return 0;
63 } 61 }
62
64 value = RANDOM () % tl->total_chance; 63 value = RANDOM () % tl->total_chance;
64
65 for (t = tl->items; t; t = t->next) 65 for (t = tl->items; t; t = t->next)
66 { 66 {
67 value -= t->chance; 67 value -= t->chance;
68 if (value < 0) 68 if (value < 0)
69 break; 69 break;
70 } 70 }
71
71 if (!t || !t->item) 72 if (!t || !t->item)
72 { 73 {
73 LOG (llevError, "resurrect_player: got null treasure from treasurelist %s!\n", &spell->race); 74 LOG (llevError, "resurrect_player: got null treasure from treasurelist %s!\n", &spell->race);
74 return 0; 75 return 0;
75 } 76 }
77
76 race = t->item->name; 78 race = t->item->archname;
77 } 79 }
78 80
79 /* set up our paths/strings... */ 81 /* set up our paths/strings... */
80 sprintf (path, "%s/%s/%s/%s", settings.localdir, settings.playerdir, playername, playername); 82 sprintf (path, "%s/%s/%s/%s", settings.localdir, settings.playerdir, playername, playername);
81 83
210 if (resurrection_fails (clevel, leveldead)) 212 if (resurrection_fails (clevel, leveldead))
211 { 213 {
212 if (spell->randomitems) 214 if (spell->randomitems)
213 for (treasure *t = spell->randomitems->items; t; t = t->next) 215 for (treasure *t = spell->randomitems->items; t; t = t->next)
214 if (t->item) 216 if (t->item)
215 summon_hostile_monsters (op, t->nrof, t->item->name); 217 summon_hostile_monsters (op, t->nrof, t->item->archname);
216 218
217 return 1; 219 return 1;
218 220
219 } 221 }
220 else 222 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines