diff options
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 1675ec0c9b..498722a4a4 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2019,6 +2019,24 @@ int get_equip_slot(const item_def *item) return worn; } +mon_inv_type get_mon_equip_slot(const monsters* mon, const item_def &item) +{ + ASSERT(mon->alive()); + + mon_inv_type slot = item_to_mslot(item); + + if (slot == NUM_MONSTER_SLOTS) + return NUM_MONSTER_SLOTS; + + if (mon->mslot_item(slot) == &item) + return slot; + + if (slot == MSLOT_WEAPON && mon->mslot_item(MSLOT_ALT_WEAPON) == &item) + return MSLOT_ALT_WEAPON; + + return NUM_MONSTER_SLOTS; +} + static std::string _drop_selitem_text( const std::vector<MenuEntry*> *s ) { char buf[130]; |