diff options
-rw-r--r-- | crawl-ref/source/command.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/main.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/wiz-you.cc | 44 |
3 files changed, 18 insertions, 29 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 6a8298359b..5066fc9732 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -2439,7 +2439,7 @@ int list_wizard_commands(bool do_redraw_screen) "<w>h</w>/<w>H</w> : heal yourself (super-Heal)\n" "<w>Ctrl-H</w> : set hunger state\n" "<w>X</w> : make Xom do something now\n" - "<w>z</w>/<w>Z</w> : cast spell by number/name\n" + "<w>z</w> : cast spell by number/name\n" "\n" "<yellow>Item related commands</yellow>\n" "<w>a</w> : acquirement\n" diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index 73a7efb002..3aa5be2325 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -530,7 +530,6 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) case 'i': wizard_identify_pack(); break; case 'I': wizard_unidentify_pack(); break; case 'z': wizard_cast_spec_spell(); break; - case 'Z': wizard_cast_spec_spell_name(); break; case '(': wizard_create_feature_number(); break; case ')': wizard_create_feature_name(); break; case ':': wizard_list_branches(); break; diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index d81e08cc39..48fdeddba8 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -152,29 +152,13 @@ void wizard_change_species( void ) #endif #ifdef WIZARD -// Casts a specific spell by number. +// Casts a specific spell by number or name. void wizard_cast_spec_spell(void) { - int spell = debug_prompt_for_int( "Cast which spell by number? ", true ); + char specs[80], *end; + int spell; - if (spell == -1) - canned_msg( MSG_OK ); - else if (your_spells( static_cast<spell_type>(spell), 0, false ) - == SPRET_ABORT) - { - crawl_state.cancel_cmd_repeat(); - } -} -#endif - - -#ifdef WIZARD -// Casts a specific spell by name. -void wizard_cast_spec_spell_name(void) -{ - char specs[80]; - - mpr("Cast which spell by name? ", MSGCH_PROMPT); + mpr("Cast which spell? ", MSGCH_PROMPT); if (cancelable_get_line_autohist( specs, sizeof( specs ) ) || specs[0] == '\0') { @@ -183,17 +167,23 @@ void wizard_cast_spec_spell_name(void) return; } - spell_type type = spell_by_name(specs, true); - if (type == SPELL_NO_SPELL) + spell = strtol(specs, &end, 10); + + if (spell < 0 || end == specs) { - mpr((one_chance_in(20)) ? "Maybe you should go back to WIZARD school." - : "I couldn't find that spell."); - crawl_state.cancel_cmd_repeat(); - return; + if ((spell = spell_by_name(specs, true)) == SPELL_NO_SPELL) + { + mpr("Cannot find that spell."); + crawl_state.cancel_cmd_repeat(); + return; + } } - if (your_spells(type, 0, false) == SPRET_ABORT) + if (your_spells( static_cast<spell_type>(spell), 0, false ) + == SPRET_ABORT) + { crawl_state.cancel_cmd_repeat(); + } } #endif |