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/stash.cc | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source/stash.cc') diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 92b400cc33..3d874cd044 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -143,7 +143,7 @@ static void save_item(FILE *file, const item_def &item) static void load_item(FILE *file, item_def &item) { - item.base_type = readByte(file); + item.base_type = static_cast(readByte(file)); item.sub_type = readByte(file); item.plus = readShort(file); item.plus2 = readShort(file); @@ -212,11 +212,12 @@ void Stash::filter(const std::string &str) base = base.substr(0, cpos); } - unsigned char basec = atoi(base.c_str()); + const object_class_type basec = + static_cast(atoi(base.c_str())); filter(basec, subc); } -void Stash::filter(unsigned char base, unsigned char sub) +void Stash::filter(object_class_type base, unsigned char sub) { item_def item; item.base_type = base; @@ -353,16 +354,7 @@ void Stash::update() // stash-tracking pre/suffixes. std::string Stash::stash_item_name(const item_def &item) { - char buf[ITEMNAME_SIZE]; - - // XXX XXX FIXME why the special-casing? - if (item.base_type == OBJ_GOLD) - snprintf(buf, sizeof buf, "%d gold piece%s", item.quantity, - (item.quantity > 1? "s" : "")); - else - return item.name(DESC_NOCAP_A); - - return buf; + return item.name(DESC_NOCAP_A); } class StashMenu : public InvMenu -- cgit v1.2.3-54-g00ecf