diff options
author | gammafunk <gammafunk@gmail.com> | 2014-05-23 23:59:41 -0500 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-05-26 23:17:43 -0500 |
commit | 2371adb45923b9b02faa5c4fff65df3c535f7de4 (patch) | |
tree | b5c251c2ab13655b90ac81848f00d68d871fd0d1 /crawl-ref/source/itemprop.cc | |
parent | 113be5ec1658845d372a7702d3ccbbfa890dc012 (diff) | |
download | crawl-ref-2371adb45923b9b02faa5c4fff65df3c535f7de4.tar.gz crawl-ref-2371adb45923b9b02faa5c4fff65df3c535f7de4.zip |
Make corpses and skeletons stationary items (minmay)
Moving corpses and skeletons to other levels or to other locations
within a level is tedious but may be optimal for corpse rot and god
abilities like Kiku's corpse prayer. This commit prevents the player
from picking up or apporting carrion. It generalizes the code used for
nets being stationary, and cleans up and documents various bits of
related item pickup code.
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 57c03d2ddd..738416575f 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -635,18 +635,39 @@ void do_uncurse_item(item_def &item, bool inscribe, bool no_ash, ash_check_bondage(); } -// Is item stationary (cannot be picked up)? -void set_item_stationary(item_def &item) +/* + * Make a net stationary (because it currently traps a victim). + * + * @param item The net item. +*/ +void set_net_stationary(item_def &item) { if (item.base_type == OBJ_MISSILES && item.sub_type == MI_THROWING_NET) item.plus2 = 1; } +/* + * Is the item stationary (unmovable) + * + * Currently only carrion and nets with a trapped victim are stationary. + * @param item The item. + * @returns True iff the item is stationary. +*/ bool item_is_stationary(const item_def &item) { - return item.base_type == OBJ_MISSILES - && item.sub_type == MI_THROWING_NET - && item.plus2; + return item.base_type == OBJ_CORPSES || item_is_stationary_net(item); +} + +/* + * Is the item a stationary net + * + * @param item The item. + * @returns True iff the item is a stationary net. +*/ +bool item_is_stationary_net(const item_def &item) +{ + return item.base_type == OBJ_MISSILES && item.sub_type == MI_THROWING_NET + && item.plus2; } static bool _in_shop(const item_def &item) |