summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-08-14 16:15:14 -0400
committerNeil Moore <neil@s-z.org>2014-08-14 16:15:14 -0400
commit717b5469982b9393369e883ab6b27d5a22cfceb2 (patch)
treed19c001045a8ca2226220555796078095f1e939b
parent13dc9f5e1b2d400509a49a2584fd6e6426564a74 (diff)
downloadcrawl-ref-717b5469982b9393369e883ab6b27d5a22cfceb2.tar.gz
crawl-ref-717b5469982b9393369e883ab6b27d5a22cfceb2.zip
Don't pretend bread is useful to felid liches (#8875)
Rather than assuming all food is long-term useful for the temporarily undead, instead check what would happen if we weren't a lich.
-rw-r--r--crawl-ref/source/itemname.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 5a33428c4d..3cdf118416 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -31,6 +31,7 @@
#include "libutil.h"
#include "makeitem.h"
#include "mon-util.h"
+#include "newgame.h" // get_undead_state
#include "notes.h"
#include "output.h"
#include "player.h"
@@ -47,6 +48,7 @@
#include "throw.h"
#include "transform.h"
#include "unicode.h"
+#include "unwind.h"
static bool _is_random_name_space(char let);
static bool _is_random_name_vowel(char let);
@@ -3521,7 +3523,15 @@ bool is_useless_item(const item_def &item, bool temp)
return false;
if (!temp && you.form == TRAN_LICH)
- return false;
+ {
+ // See what would happen if we were in our normal state.
+ unwind_var<transformation_type> formsim(you.form, TRAN_NONE);
+ unwind_var<undead_state_type> lifesim(you.is_undead,
+ get_undead_state(you.species));
+
+ if (!is_inedible(item))
+ return false;
+ }
if (is_fruit(item) && you_worship(GOD_FEDHAS))
return false;