diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 01:19:56 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-19 01:19:56 +0000 |
commit | 725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd (patch) | |
tree | d2644ce5f13e7ab649b27b49f7bdcde18802a6b1 /crawl-ref/source/cio.cc | |
parent | 1a36197574afe860feff7208cd883770a5d28946 (diff) | |
download | crawl-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/cio.cc')
-rw-r--r-- | crawl-ref/source/cio.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc index 4296b65654..bc9909c29b 100644 --- a/crawl-ref/source/cio.cc +++ b/crawl-ref/source/cio.cc @@ -108,6 +108,19 @@ void get_input_line( char *const buff, int len ) { buff[0] = 0; // just in case + if (crawl_state.is_replaying_keys()) + { + ASSERT(crawl_state.input_line_curr < + crawl_state.input_line_strs.size()); + + unsigned int curr = crawl_state.input_line_curr++; + std::string &line = crawl_state.input_line_strs[curr]; + + strcpy(buff, line.c_str()); + + return; + } + #if defined(UNIX) get_input_line_from_curses( buff, len ); // implemented in libunix.cc #elif defined(WIN32CONSOLE) @@ -137,6 +150,8 @@ void get_input_line( char *const buff, int len ) else break; } + + crawl_state.input_line_strs.push_back(buff); } // Hacky wrapper around getch() that returns CK_ codes for keys |