… | |
… | |
33 | /* This returns a random spell from 'ob'. If skill is set, then |
33 | /* This returns a random spell from 'ob'. If skill is set, then |
34 | * the spell must be of this skill, it can be NULL in which case all |
34 | * the spell must be of this skill, it can be NULL in which case all |
35 | * matching spells are used. |
35 | * matching spells are used. |
36 | */ |
36 | */ |
37 | object * |
37 | object * |
38 | find_random_spell_in_ob (object *ob, const char *skill) |
38 | find_random_spell_in_ob (object *ob, shstr_cmp skill) |
39 | { |
39 | { |
40 | int k = 0, s; |
40 | int k = 0, s; |
41 | |
41 | |
42 | for (object *tmp = ob->inv; tmp; tmp = tmp->below) |
42 | for (object *tmp = ob->inv; tmp; tmp = tmp->below) |
43 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
43 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
… | |
… | |
247 | /* Checks to see if player knows the spell. If the name is the same |
247 | /* Checks to see if player knows the spell. If the name is the same |
248 | * as an existing spell, we presume they know it. |
248 | * as an existing spell, we presume they know it. |
249 | * returns 1 if they know the spell, 0 if they don't. |
249 | * returns 1 if they know the spell, 0 if they don't. |
250 | */ |
250 | */ |
251 | object * |
251 | object * |
252 | check_spell_known (object *op, const char *name) |
252 | check_spell_known (object *op, shstr_cmp name) |
253 | { |
253 | { |
254 | object *spop; |
254 | object *spop; |
255 | shstr_cmp name_ (name); |
|
|
256 | |
255 | |
257 | for (spop = op->inv; spop; spop = spop->below) |
256 | for (spop = op->inv; spop; spop = spop->below) |
258 | if (spop->type == SPELL && spop->name == name) |
257 | if (spop->type == SPELL && spop->name == name) |
259 | return spop; |
258 | return spop; |
260 | |
259 | |