summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-09 16:17:48 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-09 16:17:48 +0000
commit7b7a36d0531a016ba81520bec2a4a4177e2ca8ed (patch)
tree2054ca1b5243de711a38a2751edc06f39d92b001 /crawl-ref/source/items.cc
parent5443a68f96b0ba24b0de77573ad36a5633b39cd7 (diff)
downloadcrawl-ref-7b7a36d0531a016ba81520bec2a4a4177e2ca8ed.tar.gz
crawl-ref-7b7a36d0531a016ba81520bec2a4a4177e2ca8ed.zip
Yikes, so many files! And all I did was add more item evaluation
functions for menu colouring and pickup... Added: emergency_item, good_item, dangerous_item, bad_item, and useless_item, all taking into account player species and mutations, so e.g. =see invisible is useless for Naga, and !poison is always bad but only useless if you don't know Evaporate. Never autopickup useless, dangerous (e.g. ?immolation) or inedible items, and simplify the item colour/pickup options accordingly. I'll have to see if pickup.lua is still even needed after this. Removed the menu_colour_prefix_id option as I can't see any reason to turn it off. Oh, and fixed a bug where Kenku were unable to stop levitating if they gained level 15 while levitating. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5658 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 157571a963..e03d56722e 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1684,7 +1684,7 @@ bool move_item_to_grid( int *const obj, int x, int y )
// Look for similar item to stack:
for (int i = igrd[x][y]; i != NON_ITEM; i = mitm[i].link)
{
- // check if item already linked here -- don't want to unlink it
+ // Check if item already linked here -- don't want to unlink it.
if (*obj == i)
return (false);
@@ -1939,7 +1939,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
if (is_blood_potion(you.inv[item_dropped])
&& you.inv[item_dropped].quantity != quant_drop)
{
- // oldest potions have been dropped
+ // Oldest potions have been dropped.
for (int i = 0; i < quant_drop; i++)
remove_oldest_blood_potion(you.inv[item_dropped]);
}
@@ -2202,7 +2202,7 @@ static bool _is_denied_autopickup(const item_def &item, std::string &iname)
if (Options.never_pickup[i].matches(iname))
return (true);
- return false;
+ return (false);
}
static bool _is_forced_autopickup(const item_def &item, std::string &iname)
@@ -2213,7 +2213,8 @@ static bool _is_forced_autopickup(const item_def &item, std::string &iname)
for (unsigned i = 0, size = Options.always_pickup.size(); i < size; ++i)
if (Options.always_pickup[i].matches(iname))
return (true);
- return false;
+
+ return (false);
}
bool item_needs_autopickup(const item_def &item)
@@ -2228,11 +2229,13 @@ bool item_needs_autopickup(const item_def &item)
return (true);
std::string itemname;
- return (((Options.autopickups & (1L << item.base_type))
+ return ((Options.autopickups & (1L << item.base_type)
+ && !is_useless_item(item) && !is_inedible(item)
+ && !is_dangerous_item(item)
#ifdef CLUA_BINDINGS
- && clua.callbooleanfn(true, "ch_autopickup", "u", &item)
+ && clua.callbooleanfn(true, "ch_autopickup", "u", &item)
#endif
- || _is_forced_autopickup(item, itemname))
+ || _is_forced_autopickup(item, itemname))
&& (Options.pickup_dropped || !(item.flags & ISFLAG_DROPPED))
&& !_is_denied_autopickup(item, itemname));
}