diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-20 10:30:20 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-20 10:30:20 +0000 |
commit | 68b3b5ac3474ceac470591c2a19e8e15b7d9d2ee (patch) | |
tree | 7b2aa907b4ee16c0befbd5c1a66bbf9f814d55d5 | |
parent | e3a40721bf278235aa56dc0c39b8f3cb4e6cd179 (diff) | |
download | crawl-ref-68b3b5ac3474ceac470591c2a19e8e15b7d9d2ee.tar.gz crawl-ref-68b3b5ac3474ceac470591c2a19e8e15b7d9d2ee.zip |
Fix assertion when buying items from shops.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8622 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/items.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/shopping.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/shopping.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 6bc86ac2aa..53f4381b7f 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -399,7 +399,7 @@ void unlink_item( int dest ) } else { - ASSERT(in_bounds(mitm[dest].pos)); + ASSERT(in_bounds(mitm[dest].pos) || is_shop_item(mitm[dest])); // Linked item on map: // diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 3f0a8f4a17..ecb0a4898d 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -1794,3 +1794,8 @@ std::string shop_name(const coord_def& where) return (sh_name); } +bool is_shop_item(const item_def &item) +{ + return (item.pos.x == 0 && item.pos.y >= 5 + && item.pos.y < (MAX_SHOPS + 5)); +} diff --git a/crawl-ref/source/shopping.h b/crawl-ref/source/shopping.h index 8cdb713626..fb9fc2e88c 100644 --- a/crawl-ref/source/shopping.h +++ b/crawl-ref/source/shopping.h @@ -27,4 +27,5 @@ std::string shop_name(const coord_def& where, bool add_stop); bool shoptype_identifies_stock(shop_type type); +bool is_shop_item(const item_def &item); #endif |