summaryrefslogtreecommitdiff
path: root/src/map/magic-expr.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-03-31 10:13:41 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-03-31 10:18:50 -0700
commit993830a5063b8d2af4240ea5bf1c06dfa4f66b7d (patch)
tree9900dab35a49132158c53497f63fbabd1fa6cc9f /src/map/magic-expr.cpp
parent1a651243bb2c8e18baa9aac30ac52a62185074e7 (diff)
downloadtmwa-993830a5063b8d2af4240ea5bf1c06dfa4f66b7d.tar.gz
tmwa-993830a5063b8d2af4240ea5bf1c06dfa4f66b7d.tar.bz2
tmwa-993830a5063b8d2af4240ea5bf1c06dfa4f66b7d.tar.xz
tmwa-993830a5063b8d2af4240ea5bf1c06dfa4f66b7d.zip
Check the equip index array
Diffstat (limited to 'src/map/magic-expr.cpp')
-rw-r--r--src/map/magic-expr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 1881afc..d05f713 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -830,13 +830,14 @@ int fun_is_equipped(dumb_ptr<env_t>, val_t *result, Slice<val_t> args)
return 1;
for (EQUIP i : EQUIPs)
- if (chr->equip_index[i] >= 0
- && chr->status.inventory[chr->equip_index[i]].nameid ==
- item.nameid)
+ {
+ int idx = chr->equip_index_maybe[i];
+ if (idx >= 0 && chr->status.inventory[idx].nameid == item.nameid)
{
retval = true;
break;
}
+ }
RESULTINT = retval;
return 0;