summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 14:44:15 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 14:44:15 +0000
commit49401e18692e235ddd101c51073d93d96a33954e (patch)
treecb0b7ebf262dbef83021c6e0497407d47993373a
parente37ab8471fcc8761a0d4a4954918ec4c679ed1bb (diff)
downloadcrawl-ref-49401e18692e235ddd101c51073d93d96a33954e.tar.gz
crawl-ref-49401e18692e235ddd101c51073d93d96a33954e.zip
Added allow_self_target option, with possible values yes, no, prompt.
Added brief documentation (could be improved.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6339 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/options_guide.txt10
-rw-r--r--crawl-ref/settings/init.txt1
-rw-r--r--crawl-ref/source/directn.cc9
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/enum.h7
-rw-r--r--crawl-ref/source/externs.h6
-rw-r--r--crawl-ref/source/initfile.cc10
-rw-r--r--crawl-ref/source/misc.cc6
-rw-r--r--crawl-ref/source/monplace.cc1
9 files changed, 41 insertions, 11 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index 270ea663a0..c0c39d151c 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -58,7 +58,7 @@ The contents of this text are:
stash_remove_decay
4-i Command Enhancements.
auto_list, easy_open, easy_unequip, easy_confirm,
- easy_butcher, always_confirm_butcher,
+ allow_self_target, easy_butcher, always_confirm_butcher,
swap_when_safe, easy_quit_item_prompts, easy_exit_menu,
sort_menus
4-j Message and Display Improvements.
@@ -976,6 +976,14 @@ easy_confirm = (none | safe)
'y', which can result in accidentally answering yes to
questions.
+allow_self_target = (yes | no | prompt)
+ Allow targeting yourself with risky magic (e.g., the spell
+ Bolt of Fire or a wand of slowing.)
+ When set to 'yes', you are a valid target. When set to 'no',
+ you cannot target yourself with such spells. When set to
+ 'prompt' (the default), you will be required to confirm
+ self-targeting.
+
easy_butcher = true
If true, auto-switch to an appropriate uncursed weapon for
butchery. For such tools any special messages are ignored. If
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index 09a2e91353..01e9c0a1fb 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -204,6 +204,7 @@ include = travel_stoppers.txt
# easy_open = false
# easy_unequip = false
# easy_confirm = (none | safe)
+# allow_self_target = (yes | no | prompt)
# easy_butcher = false
# always_confirm_butcher = true
# swap_when_safe = false
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 02fd4582fc..6b7e417277 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -1044,14 +1044,17 @@ void direction(dist& moves, targeting_type restricts,
// A bunch of confirmation tests; if we survive them all,
// then break out.
- // Confirm self-targeting on TARG_ENEMY.
+ // Confirm self-targeting on TARG_ENEMY (option-controlled.)
// Conceivably we might want to confirm on TARG_ANY too.
if (moves.isTarget
&& moves.tx == you.x_pos && moves.ty == you.y_pos
&& mode == TARG_ENEMY
- && !yesno("Really target yourself?", false, 'n'))
+ && (Options.allow_self_target == CONFIRM_CANCEL
+ || (Options.allow_self_target == CONFIRM_PROMPT
+ && !yesno("Really target yourself?", false, 'n'))))
{
- mesclr();
+ if (Options.allow_self_target == CONFIRM_CANCEL )
+ mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER);
show_prompt = true;
}
else if ( moves.isTarget && !see_grid(moves.tx, moves.ty) )
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index c8612dc3a3..8df2cee58c 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -301,7 +301,7 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
}
#endif
- std::string cast_into = "";
+ std::string cast_into;
switch (gate_type)
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 764f3f2dc5..667f517e29 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -680,6 +680,13 @@ enum conduct_type
NUM_CONDUCTS
};
+enum confirm_prompt_type
+{
+ CONFIRM_CANCEL, // automatically answer 'no', i.e. disallow
+ CONFIRM_PROMPT, // prompt
+ CONFIRM_NONE // automatically answer 'yes'
+};
+
enum confirm_level_type
{
CONFIRM_NONE_EASY,
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 2d0066e431..1344136775 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1665,8 +1665,10 @@ public:
int note_hp_percent; // percentage hp for notetaking
int ood_interesting; // how many levels OOD is noteworthy?
int rare_interesting; // what monster rarity is noteworthy?
- int easy_confirm; // make yesno() confirming easier
- int easy_quit_item_prompts; // make item prompts quitable on space
+ confirm_level_type easy_confirm; // make yesno() confirming easier
+ bool easy_quit_item_prompts; // make item prompts quitable on space
+ confirm_prompt_type allow_self_target; // yes, no, prompt
+
int colour[16]; // macro fg colours to other colours
int background; // select default background colour
int channels[NUM_MESSAGE_CHANNELS]; // msg channel colouring
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index c1c59a9d37..9127da00d7 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -676,6 +676,7 @@ void game_options::reset_options()
list_rotten = true;
easy_confirm = CONFIRM_SAFE_EASY;
easy_quit_item_prompts = true;
+ allow_self_target = CONFIRM_PROMPT;
hp_warning = 10;
magic_point_warning = 0;
default_target = true;
@@ -1942,6 +1943,15 @@ void game_options::read_option_line(const std::string &str, bool runscript)
easy_confirm = CONFIRM_SAFE_EASY;
}
else BOOL_OPTION(easy_quit_item_prompts);
+ else if (key == "allow_self_target")
+ {
+ if (field == "yes")
+ allow_self_target = CONFIRM_NONE;
+ else if (field == "no")
+ allow_self_target = CONFIRM_CANCEL;
+ else if (field == "prompt")
+ allow_self_target = CONFIRM_PROMPT;
+ }
else BOOL_OPTION_NAMED("easy_quit_item_lists", easy_quit_item_prompts);
else BOOL_OPTION(easy_open);
else BOOL_OPTION(easy_unequip);
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index a4865d6ca8..c7ecf4b35f 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1731,7 +1731,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
int i;
const level_area_type old_level_type = you.level_type;
const dungeon_feature_type stair_find =
- force_stair? force_stair : grd[you.x_pos][you.y_pos];
+ force_stair? force_stair : grd(you.pos());
branch_type old_where = you.where_are_you;
@@ -1774,8 +1774,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
if (shaft)
{
- bool known_trap = (grd[you.x_pos][you.y_pos] != DNGN_UNDISCOVERED_TRAP
- && !force_stair);
+ const bool known_trap = (grd(you.pos()) != DNGN_UNDISCOVERED_TRAP
+ && !force_stair);
if (!known_trap && !force_stair)
{
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index ea23e4b5be..71b2e3b58a 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -2202,7 +2202,6 @@ bool empty_surrounds(int emx, int emy, dungeon_feature_type spc_wanted,
if (success && one_chance_in(++good_count))
{
- // Add point to list of good points.
empty[0] = tx;
empty[1] = ty;
}