From 30335063bff54c2b4782689eebdb3b2717e878fa Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Fri, 1 Mar 2013 11:45:15 -0800 Subject: Convince skills to work --- src/map/magic-expr.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/map/magic-expr.cpp') diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp index a366cc0..0acc50a 100644 --- a/src/map/magic-expr.cpp +++ b/src/map/magic-expr.cpp @@ -582,13 +582,17 @@ static int fun_skill(env_t *, int, val_t *result, val_t *args) { if (ENTITY_TYPE(0) != BL::PC - // don't convert to enum until after the range check + // don't convert to enum until after the range check || ARGINT(1) < 0 - || ARGINT(1) >= uint16_t(MAX_SKILL) - || ARGPC(0)->status.skill[SkillID(ARGINT(1))].id != SkillID(ARGINT(1))) + || ARGINT(1) >= uint16_t(MAX_SKILL)) + { RESULTINT = 0; + } else - RESULTINT = ARGPC(0)->status.skill[SkillID(ARGINT(1))].lv; + { + SkillID id = static_cast(ARGINT(1)); + RESULTINT = ARGPC(0)->status.skill[id].lv; + } return 0; } -- cgit v1.2.3-60-g2f50