summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-10 12:13:52 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-10 12:13:52 +0000
commitc19654b6135f04e1b846a12818319d829d704fe8 (patch)
tree08e2d9ac0c9c9face8cb3f51b6549373378797ce /crawl-ref/source/items.cc
parentca24077fe2dc9c9f381ebbccb70c04fd143ea718 (diff)
downloadcrawl-ref-c19654b6135f04e1b846a12818319d829d704fe8.tar.gz
crawl-ref-c19654b6135f04e1b846a12818319d829d704fe8.zip
[1632207] Dropping items on an altar while praying will offer those items to
$DEITY. If it's a multidrop, only the last item will trigger the altar-offer to avoid spammy messages. Interrupted multidrop will not do the offer, nor will the offer happen if prayer ends before the last item is dropped. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@821 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 8db00d95c8..86defb8de3 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1708,7 +1708,8 @@ bool move_top_item( int src_x, int src_y, int dest_x, int dest_y )
return (true);
}
-bool drop_item( int item_dropped, int quant_drop ) {
+bool drop_item( int item_dropped, int quant_drop, bool try_offer )
+{
if (quant_drop < 0 || quant_drop > you.inv[item_dropped].quantity)
quant_drop = you.inv[item_dropped].quantity;
@@ -1774,9 +1775,10 @@ bool drop_item( int item_dropped, int quant_drop ) {
const unsigned char my_grid = grd[you.x_pos][you.y_pos];
- if ( !grid_destroys_items(my_grid) &&
- !copy_item_to_grid( you.inv[item_dropped],
- you.x_pos, you.y_pos, quant_drop, true )) {
+ if ( !grid_destroys_items(my_grid)
+ && !copy_item_to_grid( you.inv[item_dropped],
+ you.x_pos, you.y_pos, quant_drop, true ))
+ {
mpr( "Too many items on this level, not dropping the item." );
return (false);
}
@@ -1785,13 +1787,20 @@ bool drop_item( int item_dropped, int quant_drop ) {
quant_name( you.inv[item_dropped], quant_drop, DESC_NOCAP_A, str_pass );
mprf( "You drop %s.", str_pass );
- if ( grid_destroys_items(my_grid) ) {
+ if ( grid_destroys_items(my_grid) )
mprf(MSGCH_SOUND, grid_item_destruction_message(my_grid));
- }
dec_inv_item_quantity( item_dropped, quant_drop );
you.turn_is_over = true;
+ if (try_offer
+ && you.religion != GOD_NO_GOD
+ && you.duration[DUR_PRAYER]
+ && grid_altar_god(grd[you.x_pos][you.y_pos]) == you.religion)
+ {
+ offer_items();
+ }
+
return (true);
}
@@ -1948,7 +1957,8 @@ void drop(void)
if ( items_for_multidrop.size() == 1 ) // only one item
{
drop_item( items_for_multidrop[0].slot,
- items_for_multidrop[0].quantity );
+ items_for_multidrop[0].quantity,
+ true );
items_for_multidrop.clear();
you.turn_is_over = true;
}