diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-26 15:31:53 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-26 15:31:53 +0000 |
commit | dd695c352f27764a0c4f1efee5ee1676678162c2 (patch) | |
tree | dca72ed2e12f7ddd638bd68598261545a92d9a58 /crawl-ref/source/items.cc | |
parent | 269a1da76046334717fed84754ca3bde5f5bffc5 (diff) | |
download | crawl-ref-dd695c352f27764a0c4f1efee5ee1676678162c2.tar.gz crawl-ref-dd695c352f27764a0c4f1efee5ee1676678162c2.zip |
Made item_def::base_type into object_class_type, instead of unsigned char.
Flushed out a few bugs as a result, specifically:
1. Some monsters (e.g., orcs) can now get blowguns as they were intended to
(look at the makeitem.cc change);
2. Acquirement will no longer attempt to give you the books of minor magic
if you've found them (look at the effects.cc change.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1374 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index af953b7d15..6a7a5098cc 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2960,7 +2960,7 @@ int inv_count(void) } static bool find_subtype_by_name(item_def &item, - int base_type, int ntypes, + object_class_type base_type, int ntypes, const std::string &name) { // In order to get the sub-type, we'll fill out the base type... @@ -3031,7 +3031,7 @@ static bool find_subtype_by_name(item_def &item, // Returns an incomplete item_def with base_type and sub_type set correctly // for the given item name. If the name is not found, sets sub_type to // OBJ_RANDOM. -item_def find_item_type(int base_type, std::string name) +item_def find_item_type(object_class_type base_type, std::string name) { item_def item; item.base_type = OBJ_RANDOM; @@ -3039,7 +3039,7 @@ item_def find_item_type(int base_type, std::string name) lowercase(name); if (base_type == OBJ_RANDOM || base_type == OBJ_UNASSIGNED) - base_type = -1; + base_type = OBJ_UNASSIGNED; static int max_subtype[] = { @@ -3062,14 +3062,15 @@ item_def find_item_type(int base_type, std::string name) 0, // "gemstones" -- no items of type }; - if (base_type == -1) + if (base_type == OBJ_UNASSIGNED) { for (unsigned i = 0; i < sizeof(max_subtype) / sizeof(*max_subtype); ++i) { if (!max_subtype[i]) continue; - if (find_subtype_by_name(item, i, max_subtype[i], name)) + if (find_subtype_by_name(item, static_cast<object_class_type>(i), + max_subtype[i], name)) break; } } |