summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/state.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 01:19:56 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 01:19:56 +0000
commit725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd (patch)
treed2644ce5f13e7ab649b27b49f7bdcde18802a6b1 /crawl-ref/source/state.h
parent1a36197574afe860feff7208cd883770a5d28946 (diff)
downloadcrawl-ref-725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd.tar.gz
crawl-ref-725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd.zip
Added new commands "re-do previous command" (bound to `) and "repeat
next command" (bound to 0). Though this is just an interface change, it changes code in the core input processing function (input() in acr.cc), and also messes around with the input buffer, so it could probably do with more testing before merging it into the 0.3 branch. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2137 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/state.h')
-rw-r--r--crawl-ref/source/state.h42
1 files changed, 34 insertions, 8 deletions
diff --git a/crawl-ref/source/state.h b/crawl-ref/source/state.h
index 2be86b8a76..0f4da3bbbd 100644
--- a/crawl-ref/source/state.h
+++ b/crawl-ref/source/state.h
@@ -38,14 +38,40 @@ struct game_state
void (*terminal_resize_handler)();
void (*terminal_resize_check)();
- game_state() : mouse_enabled(false), waiting_for_command(false),
- terminal_resized(false), io_inited(false), need_save(false),
- saving_game(false), updating_scores(false),
- seen_hups(0), map_stat_gen(false), unicode_ok(false),
- glyph2strfn(NULL), multibyte_strlen(NULL),
- terminal_resize_handler(NULL), terminal_resize_check(NULL)
- {
- }
+ bool doing_prev_cmd_again;
+ command_type prev_cmd;
+ std::deque<int> prev_cmd_keys;
+
+ command_type repeat_cmd;
+ std::deque<int> repeat_cmd_keys;
+ bool cmd_repeat_start;
+ int cmd_repeat_count;
+ int cmd_repeat_goal;
+ int prev_cmd_repeat_goal;
+ int prev_repetition_turn;
+ bool cmd_repeat_started_unsafe;
+
+ std::vector<std::string> input_line_strs;
+ unsigned int input_line_curr;
+
+protected:
+ void reset_cmd_repeat();
+ void reset_cmd_again();
+
+public:
+ game_state();
+
+ bool is_replaying_keys() const;
+
+ bool is_repeating_cmd() const;
+
+ void cancel_cmd_repeat(std::string reason = "");
+ void cancel_cmd_again(std::string reason = "");
+
+ void cant_cmd_repeat(std::string reason = "");
+ void cant_cmd_again(std::string reason = "");
+
+ void zero_turns_taken();
void check_term_size() const
{