diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-28 07:58:50 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-28 07:58:50 +0000 |
commit | c83c83056ee1f25c7caba5301ef17adcf142b56c (patch) | |
tree | 611bd3f4c607909e4b907a99d81151f67654dd4f /crawl-ref/source/items.cc | |
parent | d6a80fc099249eb2e9d759b92e0e248e5a925256 (diff) | |
download | crawl-ref-c83c83056ee1f25c7caba5301ef17adcf142b56c.tar.gz crawl-ref-c83c83056ee1f25c7caba5301ef17adcf142b56c.zip |
Fixed issues with substring matches of item names (spears being generated for
pears) in maps (David). The change also means that item names have to be
specified in full in map definitions.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2233 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 94212b9335..60bacbd15b 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2953,24 +2953,14 @@ static bool find_subtype_by_name(item_def &item, return (true); int type_wanted = -1; - int best_index = 10000; - const char *ptr; for (int i = 0; i < ntypes; i++) { item.sub_type = i; - char obj_name[ITEMNAME_SIZE]; - strncpy(obj_name, item.name(DESC_PLAIN).c_str(), sizeof obj_name); - - ptr = strstr( strlwr(obj_name), name.c_str() ); - if (ptr != NULL) + if (name == lowercase_string(item.name(DESC_PLAIN))) { - // earliest match is the winner - if (ptr - obj_name < best_index) - { - type_wanted = i; - best_index = ptr - obj_name; - } + type_wanted = i; + break; } } |