summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 12:10:59 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 12:10:59 +0000
commitfb0ab9913b253f6648b2848e7432f29f4b1f2d9f (patch)
tree9702c084398bb4972fcca9f20e57d86e14917727 /crawl-ref/source
parent47146d5cc5e08c3afe7f14a7af610db364a99aef (diff)
downloadcrawl-ref-fb0ab9913b253f6648b2848e7432f29f4b1f2d9f.tar.gz
crawl-ref-fb0ab9913b253f6648b2848e7432f29f4b1f2d9f.zip
Cleanup: move_item_to_grid returns a bool to indicate that drop was successful.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2471 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-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)