summaryrefslogtreecommitdiff
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
commit528a95aaef400b264203d3e8621887ea0307e9ea (patch)
treeb4eb6bf288613dff26b14e6c5eec7c35bce2c797
parenta058cf79ddddcbc5ebd9072ba27d8c5df20cd8cf (diff)
Make get_level_device_1 take a spell_type instead of an index
-rw-r--r--src/lua_bind.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lua_bind.cc b/src/lua_bind.cc
index de16ad42..82d4009a 100644
--- a/src/lua_bind.cc
+++ b/src/lua_bind.cc
@@ -74,12 +74,11 @@ s32b lua_get_level(spell_type *spell, s32b lvl, s32b max, s32b min, s32b bonus)
return lvl;
}
-static s32b get_level_device_1(s32b s, s32b max, s32b min)
+static s32b get_level_device_1(spell_type *spell, s32b max, s32b min)
{
// Must be in "device" mode.
assert(get_level_use_stick > -1);
// Delegate
- auto spell = spell_at(s);
auto device_skill = s_info[SKILL_DEVICE].value;
return get_level_device(spell, max, min, device_skill);
}
@@ -113,7 +112,7 @@ int get_mana(s32b s)
static s32b spell_chance_device(s32b s)
{
spell_type *s_ptr = spell_at(s);
- int level = get_level_device_1(s, 50, 1);
+ int level = get_level_device_1(s_ptr, 50, 1);
int minfail;
s32b chance = spell_type_failure_rate(s_ptr);
@@ -184,11 +183,11 @@ s32b spell_chance(s32b s)
s32b get_level(s32b s, s32b max, s32b min)
{
+ auto spell = spell_at(s);
/** Ahah shall we use Magic device instead ? */
if (get_level_use_stick > -1) {
- return get_level_device_1(s, max, min);
+ return get_level_device_1(spell, max, min);
} else {
- auto spell = spell_at(s);
return get_level_school_1(spell, max, min);
}
}