diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-06-26 10:01:40 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-06-26 10:01:40 +0200 |
commit | 3224281f94c23f0fecc66e478da2d647b8c0c588 (patch) | |
tree | 14539150773fb14c1db307a6c084093ed48195fc /src | |
parent | d15295cab3c0eaebb772f608664d8138cd72e976 (diff) |
Show spells imeddiately when casting
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd5.c | 83 |
1 files changed, 23 insertions, 60 deletions
@@ -2152,8 +2152,7 @@ s32b get_school_spell(cptr do_what, s16b force_book) int num = 0; s32b where = 1; int ask; - bool_ flag, redraw; - char choice; + bool_ flag; char out_val[160]; char buf2[40]; char buf3[40]; @@ -2202,9 +2201,6 @@ s32b get_school_spell(cptr do_what, s16b force_book) /* Nothing chosen yet */ flag = FALSE; - /* No redraw yet */ - redraw = FALSE; - /* Show choices */ if (show_choices) { @@ -2227,51 +2223,40 @@ s32b get_school_spell(cptr do_what, s16b force_book) pval = o_ptr->pval2; } + /* Save the screen */ + character_icky = TRUE; + Term_save(); + + /* Go */ if (hack_force_spell == -1) { num = school_book_length(sval); /* Build a prompt (accept all spells) */ - strnfmt(out_val, 78, "(Spells %c-%c, Descs %c-%c, *=List, ESC=exit) %^s which spell? ", + strnfmt(out_val, 78, "(Spells %c-%c, Descs %c-%c, ESC=exit) %^s which spell? ", I2A(0), I2A(num - 1), I2A(0) - 'a' + 'A', I2A(num - 1) - 'a' + 'A', do_what); /* Get a spell from the user */ - while (!flag && get_com(out_val, &choice)) + while (!flag) { - /* Request redraw */ - if (((choice == ' ') || (choice == '*') || (choice == '?'))) - { - /* Show the list */ - if (!redraw) - { - /* Show list */ - redraw = TRUE; - - /* Save the screen */ - character_icky = TRUE; - Term_save(); - - /* Display a list of spells */ - where = print_book(sval, pval, o_ptr); - } + char choice; - /* Hide the list */ - else - { - /* Hide list */ - redraw = FALSE; - where = 1; + /* Restore and save screen; this prevents + subprompt from leaving garbage when going + around the loop multiple times. */ + Term_load(); + Term_save(); - /* Restore the screen */ - Term_load(); - character_icky = FALSE; - } + /* Display a list of spells */ + where = print_book(sval, pval, o_ptr); - /* Redo asking */ - continue; + /* Input */ + if (!get_com(out_val, &choice)) + { + flag = FALSE; + break; } - /* Note verify */ ask = (isupper(choice)); @@ -2291,25 +2276,6 @@ s32b get_school_spell(cptr do_what, s16b force_book) /* Verify it */ if (ask) { - /* Show the list */ - if (!redraw) - { - /* Show list */ - redraw = TRUE; - - /* Save the screen */ - character_icky = TRUE; - Term_load(); - Term_save(); - - } - /* Rstore the screen */ - else - { - /* Restore the screen */ - Term_load(); - } - /* Display a list of spells */ where = print_book(sval, pval, o_ptr); print_spell_desc(spell_x(sval, pval, i), where); @@ -2359,11 +2325,8 @@ s32b get_school_spell(cptr do_what, s16b force_book) /* Restore the screen */ - if (redraw) - { - Term_load(); - character_icky = FALSE; - } + Term_load(); + character_icky = FALSE; /* Show choices */ |