From dd6fbd53b6498ddcc544fdff3eeffb3f6cdde95a Mon Sep 17 00:00:00 2001 From: myk002 Date: Fri, 15 Jul 2022 09:07:14 -0700 Subject: [PATCH] add getEntries() to the CommandHistory API so we can export them to lua also bump the default history size to 5000 from the paltry 100 we had --- library/include/Console.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/include/Console.h b/library/include/Console.h index 0882ba449..39a19b152 100644 --- a/library/include/Console.h +++ b/library/include/Console.h @@ -32,6 +32,7 @@ distribution. #include #include #include +#include namespace tthread { class mutex; @@ -44,7 +45,7 @@ namespace DFHack class CommandHistory { public: - CommandHistory(std::size_t capacity = 100) + CommandHistory(std::size_t capacity = 5000) { this->capacity = capacity; } @@ -114,6 +115,12 @@ namespace DFHack { history.pop_front(); } + /// adds the current list of entries to the given vector + void getEntries(std::vector &entries) + { + for (auto &entry : history) + entries.push_back(entry); + } private: std::size_t capacity; std::deque history;