summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-util.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 06:04:37 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 06:04:37 +0000
commit73a79a3d492e24d7cc922f791326b66c47c6bc71 (patch)
tree64b792181632b680102cd99cb11440c83b2338d9 /crawl-ref/source/spl-util.cc
parent41e6f24153922d2c6584351c276a87128ee844db (diff)
downloadcrawl-ref-73a79a3d492e24d7cc922f791326b66c47c6bc71.tar.gz
crawl-ref-73a79a3d492e24d7cc922f791326b66c47c6bc71.zip
Changed spell_by_name() so that even if partial matches are allowed,
exact matches are still prefered over partial matches. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5591 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r--crawl-ref/source/spl-util.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 5d7997d7c5..d3bca7ef8a 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -121,7 +121,12 @@ spell_type spell_by_name(std::string name, bool partial_match)
const std::string spell_name = lowercase_string(sptitle);
if (spell_name.find(name) != std::string::npos)
+ {
+ if (spell_name == name)
+ return static_cast<spell_type>(i);
+
spellmatch = i;
+ }
}
return (spellmatch != -1? static_cast<spell_type>(spellmatch)