diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-30 09:22:02 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-30 09:22:02 +0000 |
commit | 51d8f1fc9cc8ed4280b9c53b135ccb0521e84889 (patch) | |
tree | c1010c752e638a1fb157977f3114a35bb53b4f59 /crawl-ref/source/spl-util.cc | |
parent | 44e703fb80e56940f4efc93d01db2988fd4914c3 (diff) | |
download | crawl-ref-51d8f1fc9cc8ed4280b9c53b135ccb0521e84889.tar.gz crawl-ref-51d8f1fc9cc8ed4280b9c53b135ccb0521e84889.zip |
Removed use of nonstandard strcasestr.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6731 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r-- | crawl-ref/source/spl-util.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 9b6f978ebd..f86cc634c9 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -142,24 +142,29 @@ spschool_flag_type school_by_name(std::string name) short_match = long_match = SPTYP_NONE; short_matches = long_matches = 0; + lowercase(name); + for (int i = 0; i <= SPTYP_RANDOM; i++) { spschool_flag_type type = (spschool_flag_type) (1 << i); - const char* short_name = spelltype_short_name(type); - const char* long_name = spelltype_long_name(type); + std::string short_name = spelltype_short_name(type); + std::string long_name = spelltype_long_name(type); + + lowercase(short_name); + lowercase(long_name); - if (strcasecmp(short_name, name.c_str()) == 0) + if (name == short_name) return type; - if (strcasecmp(long_name, name.c_str()) == 0) + if (name == long_name) return type; - if (strcasestr(short_name, name.c_str())) + if (short_name.find(name) != std::string::npos) { short_match = type; short_matches++; } - if (strcasestr(long_name, name.c_str())) + if (long_name.find(name) != std::string::npos) { long_match = type; long_matches++; |