diff options
author | Neil Moore <neil@s-z.org> | 2014-05-29 12:43:58 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-05-29 12:44:40 -0400 |
commit | 863110b63a79a4e393839443fe477be7b99546a8 (patch) | |
tree | b513a46c245f70335a2e6f1a700beecd6bd27cc1 /crawl-ref/source/invent.cc | |
parent | 7958666ef717dc3c7821e2f335bb1c5bd296a28a (diff) | |
download | crawl-ref-863110b63a79a4e393839443fe477be7b99546a8.tar.gz crawl-ref-863110b63a79a4e393839443fe477be7b99546a8.zip |
Show holdee of stationary nets in item menus.
This includes both the pickup menu "(holding you)" and Ctrl-X "(holding
a kobold)". If the monster is invisible, "(holding something)".
Adds a few asserts for bad nets: stationary nets not on the ground, or
with no actor or their square.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index ea71fc79fd..8caabd8f3a 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -19,6 +19,7 @@ #include "artefact.h" #include "clua.h" #include "colour.h" +#include "coord.h" // for ASSERT_IN_BOUNDS #include "command.h" #include "decks.h" #include "describe.h" @@ -37,6 +38,7 @@ #include "stuff.h" #include "mon-util.h" #include "state.h" +#include "terrain.h" // for actor_at #include "throw.h" #ifdef USE_TILE @@ -80,6 +82,17 @@ InvEntry::InvEntry(const item_def &i, bool show_bg) else text = i.name(DESC_A, false); + if (item_is_stationary_net(i)) + { + // Stationary nets should not be in inventory etc. + ASSERT_IN_BOUNDS(i.pos); + actor * const a = actor_at(i.pos); + ASSERTM(a, "No actor under stationary net at (%d,%d)", + i.pos.x, i.pos.y); + + text += make_stringf(" (holding %s)", a->name(DESC_A).c_str()); + } + if (i.base_type != OBJ_GOLD && in_inventory(i)) add_hotkey(index_to_letter(i.link)); else |