summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 10:14:43 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 10:14:43 +0000
commit2646935abb9acd7cd6ec4ee43e27d7f4417af775 (patch)
treeffb13cec3362a28abc07f9724945ab3dac346742 /crawl-ref
parent9dd7a1b6250fea48dfc8901afabf7845a3487eff (diff)
downloadcrawl-ref-2646935abb9acd7cd6ec4ee43e27d7f4417af775.tar.gz
crawl-ref-2646935abb9acd7cd6ec4ee43e27d7f4417af775.zip
Require confirmation before purchasing in a shop.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@649 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/shopping.cc14
-rw-r--r--crawl-ref/source/stuff.cc7
-rw-r--r--crawl-ref/source/stuff.h3
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 );