summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-util.cc
diff options
context:
space:
mode:
authorRobert Burnham <burnhamrobertp@gmail.com>2011-10-25 15:38:46 -0500
committerRobert Burnham <burnhamrobertp@gmail.com>2011-10-25 15:38:46 -0500
commitce5cd1e9df7f220ee7d07b285b76473ec9fb928f (patch)
tree9f56ef300bc15746c2cde58dcbd09c2df1bdac95 /crawl-ref/source/dbg-util.cc
parent71b738e8b44d6dad14c29bc898eff2ac700e9e1e (diff)
parent5efc2ebb172e0046e26e8b4a5114359f2e217628 (diff)
downloadcrawl-ref-ce5cd1e9df7f220ee7d07b285b76473ec9fb928f.tar.gz
crawl-ref-ce5cd1e9df7f220ee7d07b285b76473ec9fb928f.zip
Merge branch 'master' into unified_combat_control
Conflicts: crawl-ref/source/Makefile.obj crawl-ref/source/dbg-scan.cc crawl-ref/source/decks.cc crawl-ref/source/describe.cc crawl-ref/source/directn.cc crawl-ref/source/evoke.cc crawl-ref/source/fight.cc crawl-ref/source/fight.h crawl-ref/source/ghost.cc crawl-ref/source/ghost.h crawl-ref/source/item_use.cc crawl-ref/source/items.cc crawl-ref/source/map_knowledge.cc crawl-ref/source/melee_attack.h crawl-ref/source/mon-abil.cc crawl-ref/source/mon-act.cc crawl-ref/source/mon-stuff.cc crawl-ref/source/monster.cc crawl-ref/source/monster.h crawl-ref/source/player.cc crawl-ref/source/player.h crawl-ref/source/shopping.cc crawl-ref/source/spl-damage.cc crawl-ref/source/spl-summoning.cc crawl-ref/source/spl-transloc.cc crawl-ref/source/stairs.cc crawl-ref/source/stuff.cc crawl-ref/source/tags.cc crawl-ref/source/traps.cc crawl-ref/source/xom.cc
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r--crawl-ref/source/dbg-util.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc
index e40f90e1b5..06a4299a29 100644
--- a/crawl-ref/source/dbg-util.cc
+++ b/crawl-ref/source/dbg-util.cc
@@ -211,7 +211,7 @@ void debug_dump_mon(const monster* mon, bool recurse)
fprintf(stderr, " travel_path.size() = %u\n",
(unsigned int)mon->travel_path.size());
- if (mon->travel_path.size() > 0)
+ if (!mon->travel_path.empty())
{
fprintf(stderr, " next travel step: %s\n",
debug_coord_str(mon->travel_path.back()).c_str());
@@ -326,6 +326,7 @@ skill_type debug_prompt_for_skill(const char *prompt)
if (specs[0] == '\0')
return (SK_NONE);
+ std::string spec = lowercase_string(specs);
skill_type skill = SK_NONE;
@@ -336,20 +337,15 @@ skill_type debug_prompt_for_skill(const char *prompt)
if (is_invalid_skill(sk))
continue;
- char sk_name[80];
- strncpy(sk_name, skill_name(sk), sizeof(sk_name));
+ std::string sk_name = lowercase_string(skill_name(sk));
- char *ptr = strstr(strlwr(sk_name), strlwr(specs));
- if (ptr != NULL)
+ size_t pos = sk_name.find(spec);
+ if (pos != std::string::npos)
{
- if (ptr == sk_name && strlen(specs) > 0)
- {
- // We prefer prefixes over partial matches.
- skill = sk;
+ skill = sk;
+ // We prefer prefixes over partial matches.
+ if (!pos)
break;
- }
- else
- skill = sk;
}
}