… | |
… | |
48 | int Con; |
48 | int Con; |
49 | |
49 | |
50 | /* reincarnation, which changes the race */ |
50 | /* reincarnation, which changes the race */ |
51 | if (spell->race) |
51 | if (spell->race) |
52 | { |
52 | { |
53 | treasurelist *tl = find_treasurelist (spell->race); |
53 | treasurelist *tl = treasurelist::find (spell->race); |
54 | treasure *t; |
54 | treasure *t; |
55 | int value; |
55 | int value; |
56 | |
56 | |
57 | if (!tl) |
57 | if (!tl) |
58 | { |
58 | { |
59 | 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); |
60 | return 0; |
60 | return 0; |
61 | } |
61 | } |
|
|
62 | |
62 | value = RANDOM () % tl->total_chance; |
63 | value = RANDOM () % tl->total_chance; |
|
|
64 | |
63 | for (t = tl->items; t; t = t->next) |
65 | for (t = tl->items; t; t = t->next) |
64 | { |
66 | { |
65 | value -= t->chance; |
67 | value -= t->chance; |
66 | if (value < 0) |
68 | if (value < 0) |
67 | break; |
69 | break; |
68 | } |
70 | } |
|
|
71 | |
69 | if (!t || !t->item) |
72 | if (!t || !t->item) |
70 | { |
73 | { |
71 | 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); |
72 | return 0; |
75 | return 0; |
73 | } |
76 | } |
|
|
77 | |
74 | race = t->item->name; |
78 | race = t->item->name; |
75 | } |
79 | } |
76 | |
80 | |
77 | /* set up our paths/strings... */ |
81 | /* set up our paths/strings... */ |
78 | 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); |