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/traps.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/traps.cc')
-rw-r--r-- | crawl-ref/source/traps.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index e047096c2b..9976e6e24c 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -261,16 +261,21 @@ bool trap_def::is_safe(actor* act) const return false; } -// Returns the number of a net on a given square. -// If trapped, only stationary ones are counted -// otherwise the first net found is returned. +/* + * Get the item index of the first net on the square. + * + * @param where The location. + * @param trapped If true, the index of the stationary net (trapping a victim) + * is returned. + * @returns The item index of the net. +*/ int get_trapping_net(const coord_def& where, bool trapped) { for (stack_iterator si(where); si; ++si) { if (si->base_type == OBJ_MISSILES && si->sub_type == MI_THROWING_NET - && (!trapped || item_is_stationary(*si))) + && (!trapped || item_is_stationary_net(*si))) { return si->index(); } @@ -284,7 +289,7 @@ static void _maybe_split_nets(item_def &item, const coord_def& where) { if (item.quantity == 1) { - set_item_stationary(item); + set_net_stationary(item); return; } @@ -300,7 +305,7 @@ static void _maybe_split_nets(item_def &item, const coord_def& where) item_colour(it); item.quantity = 1; - set_item_stationary(item); + set_net_stationary(item); copy_item_to_grid(it, where); } @@ -1727,6 +1732,14 @@ level_id generic_shaft_dest(coord_def pos, bool known = false) return _generic_shaft_dest(level_pos(level_id::current(), pos)); } +/* + * When a player falls through a shaft at a location, disperse items on the + * target level. + * + * @param pos The location. + * @param open_shaft If True and the location was seen, print a shaft opening + * message, otherwise don't. +*/ void handle_items_on_shaft(const coord_def& pos, bool open_shaft) { if (!is_valid_shaft_level()) @@ -1748,7 +1761,7 @@ void handle_items_on_shaft(const coord_def& pos, bool open_shaft) { int next = mitm[o].link; - if (mitm[o].defined() && !item_is_stationary(mitm[o])) + if (mitm[o].defined() && !item_is_stationary_net(mitm[o])) { if (need_open_message) { |