diff options
-rw-r--r-- | crawl-ref/source/shopping.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/stuff.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/stuff.h | 3 |
3 files changed, 15 insertions, 9 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index e064b0cee5..05a394f426 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -327,11 +327,15 @@ char in_a_shop( char shoppy, id_arr id ) more3(); goto purchase; } - - shop_set_ident_type( shoppy, shop_id, mitm[shop_items[ft]].base_type, - mitm[shop_items[ft]].sub_type ); - - purchase( shoppy, shop_items[ft], gp_value ); + snprintf(info, INFO_SIZE, "Purchase %s (%d gold)? [y/n]", + item_name(mitm[shop_items[ft]], DESC_NOCAP_A), gp_value); + shop_print(info, 20); + if ( yesno(NULL, true, 'n', false, false, true) ) + { + shop_set_ident_type( shoppy, shop_id, mitm[shop_items[ft]].base_type, + mitm[shop_items[ft]].sub_type ); + purchase( shoppy, shop_items[ft], gp_value ); + } goto print_stock; diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index a9bde6fb46..8525c56113 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -703,7 +703,7 @@ void canned_msg(unsigned char which_message) // jmf: general helper (should be used all over in code) // -- idea borrowed from Nethack bool yesno( const char *str, bool safe, int safeanswer, bool clear_after, - bool interrupt_delays ) + bool interrupt_delays, bool noprompt ) { unsigned char tmp; @@ -711,7 +711,8 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after, interrupt_activity( AI_FORCE_INTERRUPT ); for (;;) { - mpr(str, MSGCH_PROMPT); + if ( !noprompt ) + mpr(str, MSGCH_PROMPT); tmp = (unsigned char) getch(); @@ -733,7 +734,7 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after, return false; else if (tmp == 'Y') return true; - else + else if (!noprompt) mpr("[Y]es or [N]o only, please."); } } // end yesno() diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 8fb8889764..74fc563b95 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -61,7 +61,8 @@ void redraw_screen(void); void canned_msg(unsigned char which_message); bool yesno( const char * str, bool safe = true, int safeanswer = 0, - bool clear_after = true, bool interrupt_delays = true ); + bool clear_after = true, bool interrupt_delays = true, + bool noprompt = false ); int yesnoquit( const char* str, bool safe = true, int safeanswer = 0, bool clear_after = true ); |