From dd695c352f27764a0c4f1efee5ee1676678162c2 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 26 Apr 2007 15:31:53 +0000 Subject: 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 --- crawl-ref/source/items.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/items.cc') 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(i), + max_subtype[i], name)) break; } } -- cgit v1.2.3-54-g00ecf