diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-26 23:27:50 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-26 23:27:50 +0000 |
commit | 0cc450e9d75d16133207718aa15492f0bbea664c (patch) | |
tree | a1189c2a8a9d4710562efcc26948a594f478cc50 /crawl-ref/source/cio.h | |
parent | 1b078175496bb877d09af420bff5331573670571 (diff) | |
download | crawl-ref-0cc450e9d75d16133207718aa15492f0bbea664c.tar.gz crawl-ref-0cc450e9d75d16133207718aa15492f0bbea664c.zip |
Promoted get_cancelable_line_autohist to cio.h as I determined how to make it work across files. (Declared it as static, as __FILE__ couldn't be used.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7026 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/cio.h')
-rw-r--r-- | crawl-ref/source/cio.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h index 27f31570aa..38e8b8a2ba 100644 --- a/crawl-ref/source/cio.h +++ b/crawl-ref/source/cio.h @@ -73,6 +73,18 @@ int cancelable_get_line( char *buf, input_history *mh = NULL, int (*keyproc)(int &c) = NULL ); +// Do not use this templated function directly. Use the macro below instead. +template<int> static int cancelable_get_line_autohist_temp(char *buf, int len) +{ + static input_history hist(10); + return cancelable_get_line(buf, len, get_number_of_cols(), &hist); +} + +// This version of cancelable_get_line will automatically retain its own +// input history, independent of other calls to cancelable_get_line. +#define cancelable_get_line_autohist(buf, len) \ + cancelable_get_line_autohist_temp<__LINE__>(buf, len) + struct c_mouse_event { coord_def pos; |