summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/message.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-01-18 14:59:15 +0100
committerRobert Vollmert <rvollmert@gmx.net>2010-01-18 15:02:20 +0100
commit1a45c20c828d1861ca6f04bf956e002fb25dccd9 (patch)
tree50c7f7a6670e4e231f834acfc06cecbe123a4c72 /crawl-ref/source/message.h
parentc41633330722fc00f01b9936f720632702882972 (diff)
downloadcrawl-ref-1a45c20c828d1861ca6f04bf956e002fb25dccd9.tar.gz
crawl-ref-1a45c20c828d1861ca6f04bf956e002fb25dccd9.zip
Copy cancelable_get_line_autohist to msgwin_get_line.
It's doubtful that this is the best way to do things.
Diffstat (limited to 'crawl-ref/source/message.h')
-rw-r--r--crawl-ref/source/message.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/crawl-ref/source/message.h b/crawl-ref/source/message.h
index 9d7bdc86db..19b2161d50 100644
--- a/crawl-ref/source/message.h
+++ b/crawl-ref/source/message.h
@@ -48,6 +48,20 @@ int msgwin_get_line(std::string prompt,
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 msgwin_get_line_autohist_temp(std::string prompt,
+ char *buf, int len)
+{
+ static input_history hist(10);
+ return msgwin_get_line(prompt, buf, len, &hist);
+}
+
+// This version of mswgin_get_line will automatically retain its own
+// input history, independent of other calls to msgwin_get_line.
+#define msgwin_get_line_autohist(prompt, buf, len) \
+ msgwin_get_line_autohist_temp<__LINE__>(prompt, buf, len)
+
class no_messages
{
public: