summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-05 07:45:25 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-05 07:45:25 +0000
commita90da56f3e29ff3399a01c28f9e7a66a05b74990 (patch)
tree344e0a924d432aed7bb2222a6806b2d6e3e86b56 /crawl-ref/source/monstuff.cc
parent9406beea182124aeb8b9d71dc829a3bcbc31cde7 (diff)
downloadcrawl-ref-a90da56f3e29ff3399a01c28f9e7a66a05b74990.tar.gz
crawl-ref-a90da56f3e29ff3399a01c28f9e7a66a05b74990.zip
Merge trunk (1403-1409] back to 0.2:
- Level-design howto. - Horn of Geryon now jelly-safe. - Mac users can double-click to run Crawl. - Prices of rings of slaying calculated correctly. - Fixed travel cache losing stair distances. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.2@1410 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc49
1 files changed, 28 insertions, 21 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index fd0cf3f637..a14d593a2e 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3784,6 +3784,32 @@ static bool monster_wants_weapon(const monsters *monster, const item_def &weap)
return (true);
}
+static bool is_item_jelly_edible(const item_def &item)
+{
+ // don't eat artefacts (note that unrandarts are randarts)
+ if (is_fixed_artefact(item) || is_random_artefact(item))
+ return (false);
+
+ // shouldn't eat stone things
+ // - but what about wands and rings?
+ if (item.base_type == OBJ_MISSILES
+ && (item.sub_type == MI_STONE || item.sub_type == MI_LARGE_ROCK))
+ {
+ return (false);
+ }
+
+ // don't eat special game items
+ if (item.base_type == OBJ_ORBS
+ || (item.base_type == OBJ_MISCELLANY
+ && (item.sub_type == MISC_RUNE_OF_ZOT
+ || item.sub_type == MISC_HORN_OF_GERYON)))
+ {
+ return (false);
+ }
+
+ return (true);
+}
+
//---------------------------------------------------------------
//
// handle_pickup
@@ -3816,28 +3842,9 @@ static bool handle_pickup(struct monsters *monster)
{
int quant = mitm[item].quantity;
- // don't eat artefacts (note that unrandarts are randarts)
- if (is_fixed_artefact(mitm[item]) ||
- is_random_artefact(mitm[item]))
- continue;
-
- // shouldn't eat stone things
- // - but what about wands and rings?
- if (mitm[item].base_type == OBJ_MISSILES
- && (mitm[item].sub_type == MI_STONE
- || mitm[item].sub_type == MI_LARGE_ROCK))
- {
- continue;
- }
-
- // don't eat special game items
- if (mitm[item].base_type == OBJ_ORBS
- || (mitm[item].base_type == OBJ_MISCELLANY
- && mitm[item].sub_type == MISC_RUNE_OF_ZOT))
- {
+ if (!is_item_jelly_edible(mitm[item]))
continue;
- }
-
+
if (mitm[igrd[monster->x][monster->y]].base_type != OBJ_GOLD)
{
if (quant > max_eat - eaten)