diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2010-10-27 20:13:19 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2010-10-27 20:13:48 +0200 |
commit | e30bbf329797b14554e80277470ba9b518aff347 (patch) | |
tree | 00fdb9c228068a048d024d7dc1acca46d31021e9 /crawl-ref/source/dbg-util.cc | |
parent | 43c94118268b9298f3108c7194efce6dda8b9580 (diff) | |
download | crawl-ref-e30bbf329797b14554e80277470ba9b518aff347.tar.gz crawl-ref-e30bbf329797b14554e80277470ba9b518aff347.zip |
Replace int by skill_type whenever possible
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r-- | crawl-ref/source/dbg-util.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc index e7d8a0b6d1..e27e85e696 100644 --- a/crawl-ref/source/dbg-util.cc +++ b/crawl-ref/source/dbg-util.cc @@ -349,25 +349,26 @@ void debug_dump_mon(const monster* mon, bool recurse) // debug_prompt_for_skill // //--------------------------------------------------------------- -int debug_prompt_for_skill(const char *prompt) +skill_type debug_prompt_for_skill(const char *prompt) { char specs[80]; msgwin_get_line_autohist(prompt, specs, sizeof(specs)); if (specs[0] == '\0') - return (-1); + return (SK_NONE); - int skill = -1; + skill_type skill = SK_NONE; - for (int i = 0; i < NUM_SKILLS; ++i) + for (int i = SK_FIRST_SKILL; i < NUM_SKILLS; ++i) { + skill_type sk = static_cast<skill_type>(i); // Avoid the bad values. - if (is_invalid_skill(i)) + if (is_invalid_skill(sk)) continue; char sk_name[80]; - strncpy(sk_name, skill_name(i), sizeof(sk_name)); + strncpy(sk_name, skill_name(sk), sizeof(sk_name)); char *ptr = strstr(strlwr(sk_name), strlwr(specs)); if (ptr != NULL) @@ -375,11 +376,11 @@ int debug_prompt_for_skill(const char *prompt) if (ptr == sk_name && strlen(specs) > 0) { // We prefer prefixes over partial matches. - skill = i; + skill = sk; break; } else - skill = i; + skill = sk; } } |