summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-26 21:45:01 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-26 21:45:01 +0000
commitc1fdfddaf2ad50929798e80ad398e25d8dae4ec0 (patch)
tree6cfbef4646923ef3cb84071a975e6a8d816bf91c /crawl-ref/source/invent.cc
parent729fc414f8443b1649e7339515decb415eb5890d (diff)
downloadcrawl-ref-c1fdfddaf2ad50929798e80ad398e25d8dae4ec0.tar.gz
crawl-ref-c1fdfddaf2ad50929798e80ad398e25d8dae4ec0.zip
Fix wording for translucent rock walls (1798932).
Change freshness calculation for chunk sorting: all chunks now sorted oldest to freshest, listing rotten last for non-Saprovores. Small comment fixes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2221 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 696dbf5bff..5298b969d3 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -148,23 +148,27 @@ const bool InvEntry::is_item_equipped() const
return (false);
}
+// returns values < 0 for edible chunks (non-rotten except for Saprovores),
+// 0 for non-chunks, and values > 0 for rotten chunks for non-Saprovores
const int InvEntry::item_freshness() const
{
if (item->base_type != OBJ_FOOD || item->sub_type != FOOD_CHUNK)
return 0;
- int freshness = item->special - 100;
+ int freshness = item->special;
+
+ if (freshness >= 100 || you.species == SP_TROLL || you.species == SP_KOBOLD
+ || you.species == SP_GHOUL || you.species == SP_OGRE
+ || you.species == SP_HILL_ORC)
+ {
+ freshness -= 300;
+ }
// Ensure that chunk freshness is never zero, since zero means
// that the item isn't a chunk.
- if (freshness >= 0)
+ if (freshness >= 0) // possibly rotten chunks
freshness++;
- // Invert if not a ghoul, so that the freshest chunks will go
- // at the top.
- if (you.species != SP_GHOUL)
- freshness *= -1;
-
return freshness;
}