From d9bc2fb6212ec9ab1a3b8ad47e57bbdfc9b469d3 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 27 Sep 2015 19:13:13 +0300 Subject: [PATCH] Add paranoid option for breaking a wand Add OPTION=paranoid_confirm:wand to prevent accidental wand breaking - suggested by scorchgeek --- doc/Guidebook.mn | 2 ++ doc/Guidebook.tex | 3 +++ include/flag.h | 3 +++ src/apply.c | 5 +++-- src/options.c | 2 ++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 1c92a483c..a039710ed 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2271,6 +2271,8 @@ require "yes" rather than 'y' to confirm attacking a peaceful monster; .PL pray require 'y' to confirm an attempt to pray rather than immediately praying; on by default; +.PL wand +require "yes" rather than 'y' to confirm breaking a wand; .PL Remove require selection from inventory for 'R' and 'T' commands even when wearing just one applicable item. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 574b31fa9..86c297b53 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -2728,6 +2728,9 @@ a peaceful monster; \item[{\tt pray~~~}] require `{\tt y}' to confirm an attempt to pray rather than immediately praying; on by default; +\item[{\tt wand}] +require ``{\tt yes}'' rather than `{\tt y}' to confirm breaking +a wand; \item[{\tt Remove~}] require selection from inventory for `{\tt R}' and `{\tt T}' commands even when wearing just one applicable item. \elist diff --git a/include/flag.h b/include/flag.h index 0a8b88492..d347f8d40 100644 --- a/include/flag.h +++ b/include/flag.h @@ -68,6 +68,7 @@ struct flag { #define PARANOID_HIT 0x10 #define PARANOID_PRAY 0x20 #define PARANOID_REMOVE 0x40 +#define PARANOID_BREAKWAND 0x80 int pickup_burden; /* maximum burden before prompt */ int pile_limit; /* controls feedback when walking over objects */ char inv_order[MAXOCLASSES]; @@ -378,6 +379,8 @@ extern NEARDATA struct instance_flags iflags; /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory item even when only one accessory or piece of armor is currently worn */ #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0) +/* breakwand: Applying a wand */ +#define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0) /* command parsing, mainly dealing with number_pad handling; not saved and restored */ diff --git a/src/apply.c b/src/apply.c index 6eceaf1e4..de27f96b8 100644 --- a/src/apply.c +++ b/src/apply.c @@ -3065,8 +3065,9 @@ struct obj *obj; char confirm[QBUFSZ], buf[BUFSZ]; boolean is_fragile = (!strcmp(OBJ_DESCR(objects[obj->otyp]), "balsa")); - if (yn(safe_qbuf(confirm, "Are you really sure you want to break ", "?", - obj, yname, ysimple_name, "the wand")) == 'n') + if (!paranoid_query(ParanoidBreakwand, + safe_qbuf(confirm, "Are you really sure you want to break ", + "?", obj, yname, ysimple_name, "the wand"))) return 0; if (nohands(youmonst.data)) { diff --git a/src/options.c b/src/options.c index 9a77e3827..448b07b24 100644 --- a/src/options.c +++ b/src/options.c @@ -1186,6 +1186,8 @@ STATIC_VAR const struct paranoia_opts { "y to pray (supersedes old \"prayconfirm\" option)" }, { PARANOID_REMOVE, "Remove", 1, "Takeoff", 1, "always pick from inventory for Remove and Takeoff" }, + { PARANOID_BREAKWAND, "wand", 1, "breakwand", 2, + "yes vs y to break a wand" }, /* for config file parsing; interactive menu skips these */ { 0, "none", 4, 0, 0, 0 }, /* require full word match */ { ~0, "all", 3, 0, 0, 0 }, /* ditto */