From 4bd7eeec09629d3c0f900d42c899fe23c69e07b6 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Fri, 14 Dec 2012 22:25:07 -0800 Subject: Prepare to trim skills --- src/map/magic-expr.cpp | 10 ++++++---- 1 file changed, 6 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 7207afc..a53f939 100644 --- a/src/map/magic-expr.cpp +++ b/src/map/magic-expr.cpp @@ -553,12 +553,13 @@ static int fun_is_in(env_t * env, int args_nr, val_t * result, val_t * args) static int fun_skill(env_t * env, int args_nr, val_t * result, val_t * args) { if (ETY(0) != BL_PC + // don't convert to enum until after the range check || ARGINT(1) < 0 - || ARGINT(1) >= MAX_SKILL - || ARGPC(0)->status.skill[ARGINT(1)].id != ARGINT(1)) + || ARGINT(1) >= uint16_t(MAX_SKILL) + || ARGPC(0)->status.skill[SkillID(ARGINT(1))].id != SkillID(ARGINT(1))) RESULTINT = 0; else - RESULTINT = ARGPC(0)->status.skill[ARGINT(1)].lv; + RESULTINT = ARGPC(0)->status.skill[SkillID(ARGINT(1))].lv; return 0; } @@ -974,7 +975,8 @@ fun_running_status_update(env_t * env, int args_nr, val_t * result, if (ETY(0) != BL_PC && ETY(0) != BL_MOB) return 1; - RESULTINT = battle_get_sc_data(ARGENTITY(0))[ARGINT(1)].timer != -1; + StatusChange sc = StatusChange(ARGINT(1)); + RESULTINT = battle_get_sc_data(ARGENTITY(0))[sc].timer != -1; return 0; } -- cgit v1.2.3-60-g2f50