summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-22 21:00:05 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-22 21:02:48 -0800
commitc94f94d6959395a96da97a4c163e44456277d1a1 (patch)
tree89f857c646b48e8bba22f4362629bc7d3c375f2b
parentce0b009e851f37ee522e7e0ef420a0e9fb0b246e (diff)
downloadcrawl-ref-c94f94d6959395a96da97a4c163e44456277d1a1.tar.gz
crawl-ref-c94f94d6959395a96da97a4c163e44456277d1a1.zip
tiles: Make mod-L-click actions do-again-able
If you fire/cast/zap at a monster with mod-L-click, then you can do the command over again with the "`" key. Doesn't work yet with spells cast via the spell pane (toggled on with "_"), or with items fired via clicking on the inventory pane.
-rw-r--r--crawl-ref/source/directn.cc9
-rw-r--r--crawl-ref/source/main.cc3
-rw-r--r--crawl-ref/source/tilereg.cc16
3 files changed, 20 insertions, 8 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index a1e9ccf2c0..cd94c49360 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -361,6 +361,7 @@ static void _direction_again(dist& moves, targetting_type restricts,
return;
}
+#ifdef DEBUG
int targ_types = 0;
if (you.prev_targ != MHITNOT && you.prev_targ != MHITYOU)
targ_types++;
@@ -368,6 +369,7 @@ static void _direction_again(dist& moves, targetting_type restricts,
targ_types++;
if (you.prev_grd_targ != coord_def(0, 0))
targ_types++;
+#endif
ASSERT(targ_types == 1);
// Discard keys until we get to a set-target command
@@ -382,7 +384,8 @@ static void _direction_again(dist& moves, targetting_type restricts,
|| key_command == CMD_TARGET_SELECT
|| key_command == CMD_TARGET_SELECT_FORCE_ENDPOINT
|| key_command == CMD_TARGET_SELECT_FORCE
- || key_command == CMD_TARGET_MAYBE_PREV_TARGET)
+ || key_command == CMD_TARGET_MAYBE_PREV_TARGET
+ || key_command == CMD_TARGET_MOUSE_SELECT)
{
break;
}
@@ -996,11 +999,7 @@ void direction(dist& moves, targetting_type restricts,
#endif
if (crawl_state.is_replaying_keys() && restricts != DIR_DIR)
- {
- _direction_again(moves, restricts, mode, range, just_looking,
- prompt, beh);
return;
- }
// NOTE: Even if just_looking is set, moves is still interesting,
// because we can travel there!
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 1f19fc89e4..5449141656 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -4474,7 +4474,8 @@ static void _update_replay_state()
}
if (!crawl_state.is_replaying_keys() && !crawl_state.cmd_repeat_start
- && crawl_state.prev_cmd != CMD_NO_CMD)
+ && crawl_state.prev_cmd != CMD_NO_CMD
+ && crawl_state.prev_cmd != CMD_NEXT_CMD)
{
if (repeat_again_rec.keys.size() > 0)
crawl_state.prev_cmd_keys = repeat_again_rec.keys;
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index a226a8240b..a99167e2ec 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1316,7 +1316,13 @@ static item_def* _get_evokable_item(const actor* target)
static bool _evoke_item_on_target(actor* target)
{
- item_def* item = _get_evokable_item(target);
+ item_def* item;
+ {
+ // Prevent the inventory letter from being recorded twice.
+ pause_all_key_recorders pause;
+
+ item = _get_evokable_item(target);
+ }
if (item == NULL)
return (false);
@@ -1377,7 +1383,13 @@ static bool _cast_spell_on_target(actor* target)
ASSERT(_spell_target == NULL);
_spell_target = target;
- const int letter = list_spells(true, false, -1, _spell_selector);
+ int letter;
+ {
+ // Prevent the spell letter from being recorded twice.
+ pause_all_key_recorders pause;
+
+ letter = list_spells(true, false, -1, _spell_selector);
+ }
_spell_target = NULL;