summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/traps.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-27 22:09:02 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-27 22:09:02 -0700
commite4d45b9975e28eb14152e6d629fb5fc4241d6d48 (patch)
tree9ffa699101b9ff50503a9c5c3042c01ba4e7bbf7 /crawl-ref/source/traps.cc
parent46567feccad9b89219b613130d1581e10f40e6c1 (diff)
downloadcrawl-ref-e4d45b9975e28eb14152e6d629fb5fc4241d6d48.tar.gz
crawl-ref-e4d45b9975e28eb14152e6d629fb5fc4241d6d48.zip
Move held_status() from stuff.cc to traps.cc
Also add some comments to stuff.h, categorizing functions for later removal.
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r--crawl-ref/source/traps.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index b45ac5a83f..39da0b2c4b 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -289,6 +289,23 @@ int get_trapping_net(const coord_def& where, bool trapped)
return NON_ITEM;
}
+/**
+ * Return a string describing the reason a given actor is ensnared. (Since nets
+ * & webs use the same status.
+ *
+ * @param actor The ensnared actor.
+ * @return Either 'held in a net' or 'caught in a web'.
+ */
+const char* held_status(actor *act)
+{
+ act = act ? act : &you;
+
+ if (get_trapping_net(act->pos(), true) != NON_ITEM)
+ return "held in a net";
+ else
+ return "caught in a web";
+}
+
// If there are more than one net on this square
// split off one of them for checking/setting values.
static void _maybe_split_nets(item_def &item, const coord_def& where)