summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/items.cc10
-rw-r--r--crawl-ref/source/items.h2
-rw-r--r--crawl-ref/source/mon-util.cc4
3 files changed, 7 insertions, 9 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 268f47cac2..7fe521fb3f 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1601,11 +1601,11 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
//
// Done this way in the hopes that it will be obvious from
// calling code that "obj" is possibly modified.
-void move_item_to_grid( int *const obj, int x, int y )
+bool move_item_to_grid( int *const obj, int x, int y )
{
// must be a valid reference to a valid object
if (*obj == NON_ITEM || !is_valid_item( mitm[*obj] ))
- return;
+ return (false);
// If it's a stackable type...
if (is_stackable_item( mitm[*obj] ))
@@ -1615,7 +1615,7 @@ void move_item_to_grid( int *const obj, int x, int y )
{
// check if item already linked here -- don't want to unlink it
if (*obj == i)
- return;
+ return (false);
if (items_stack( mitm[*obj], mitm[i] ))
{
@@ -1624,7 +1624,7 @@ void move_item_to_grid( int *const obj, int x, int y )
inc_mitm_item_quantity( i, mitm[*obj].quantity );
destroy_item( *obj );
*obj = i;
- return;
+ return (true);
}
}
}
@@ -1668,7 +1668,7 @@ void move_item_to_grid( int *const obj, int x, int y )
set_branch_flags(BFLAG_HAS_ORB);
}
- return;
+ return (true);
}
void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y )
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index 2a451f7551..15bfc072ab 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -37,7 +37,7 @@ bool dec_mitm_item_quantity( int obj, int amount );
void inc_inv_item_quantity( int obj, int amount );
void inc_mitm_item_quantity( int obj, int amount );
-void move_item_to_grid( int *const obj, int x, int y );
+bool move_item_to_grid( int *const obj, int x, int y );
void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y );
int move_item_to_player( int obj, int quant_got, bool quiet = false );
bool is_stackable_item( const item_def &item );
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b62abfedac..0be5705717 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2951,9 +2951,7 @@ bool monsters::drop_item(int eslot, int near)
}
const std::string iname = mitm[index].name(DESC_NOCAP_A);
- move_item_to_grid(&index, x, y);
-
- if (index == inv[eslot])
+ if (!move_item_to_grid(&index, x, y))
{
// Re-equip item if we somehow failed to drop it.
if (was_unequipped)