summaryrefslogtreecommitdiff
path: root/src/cmd5.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:55 +0100
committerBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:55 +0100
commit5db9e06833d5a98ab3e9fefc2eb2de6680d4c59b (patch)
treeb2022fadbe6666dfd52a6e773b89e0f814535b7f /src/cmd5.cc
parent8e4d24451390dbf4250ad5908faaffe43dc366f1 (diff)
Use get_level_school explicitly in is_ok_spell
We are guaranteed that is_ok_spell is only ever called on "school spells", so this should be behavior-preserving.
Diffstat (limited to 'src/cmd5.cc')
-rw-r--r--src/cmd5.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd5.cc b/src/cmd5.cc
index d2a537df..60c51a1d 100644
--- a/src/cmd5.cc
+++ b/src/cmd5.cc
@@ -2130,17 +2130,21 @@ bool_ is_ok_spell(s32b spell_idx, object_type *o_ptr)
{
spell_type *spell = spell_at(spell_idx);
assert(o_ptr != NULL);
-
- if (get_level(spell_idx, 50, 0) == 0)
+ // Calculate availability based on caster's skill level.
+ s32b level;
+ bool_ na;
+ get_level_school(spell_idx, 50, 0, &level, &na);
+ if (na || (level == 0))
{
return FALSE;
}
-
+ // Are we permitted to cast based on item pval? Only music
+ // spells have non-zero minimum PVAL.
if (o_ptr->pval < spell_type_minimum_pval(spell))
{
return FALSE;
}
-
+ // OK, we're permitted to cast it.
return TRUE;
}