Clean up some spell-related code
Add two helper functions and use those outside of spell.c, instead of iterating through all the spells.
This commit is contained in:
11
src/apply.c
11
src/apply.c
@@ -1761,15 +1761,8 @@ jump(int magic) /* 0=Physical, otherwise skill level */
|
||||
coord cc;
|
||||
|
||||
/* attempt "jumping" spell if hero has no innate jumping ability */
|
||||
if (!magic && !Jumping) {
|
||||
int sp_no;
|
||||
|
||||
for (sp_no = 0; sp_no < MAXSPELL; ++sp_no)
|
||||
if (g.spl_book[sp_no].sp_id == NO_SPELL)
|
||||
break;
|
||||
else if (g.spl_book[sp_no].sp_id == SPE_JUMPING)
|
||||
return spelleffects(sp_no, FALSE);
|
||||
}
|
||||
if (!magic && !Jumping && known_spell(SPE_JUMPING))
|
||||
return spelleffects(spell_idx(SPE_JUMPING), FALSE);
|
||||
|
||||
if (!magic && (nolimbs(g.youmonst.data) || slithy(g.youmonst.data))) {
|
||||
/* normally (nolimbs || slithy) implies !Jumping,
|
||||
|
||||
Reference in New Issue
Block a user