diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/consoleinterface.cc | 14 | ||||
-rw-r--r-- | src/sys/consoleinterface.h | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/sys/consoleinterface.cc b/src/sys/consoleinterface.cc index 8b734ff..45508ee 100644 --- a/src/sys/consoleinterface.cc +++ b/src/sys/consoleinterface.cc @@ -23,6 +23,8 @@ ConsoleInterface::ConsoleInterface() sys::quit(2); } + consoleinterface_rcon = false; + consoleinterface_instance = this; consoleinterface_text.clear(); consoleinterface_buffer.clear(); @@ -64,6 +66,9 @@ std::ostream & ConsoleInterface::debugstream() void ConsoleInterface::flush() { + if (rcon()) + return; + char line[MAXCMDSIZE]; while(consoleinterface_buffer.getline(line, MAXCMDSIZE-1)) { @@ -170,4 +175,13 @@ void ConsoleInterface::print_ansi(const char *line) std::cout << "\033[0;39m"; } +void ConsoleInterface::buffer_rcon(bool enable) +{ + if (enable) { + flush(); + } + + consoleinterface_rcon = enable; +} + } // namespace sys diff --git a/src/sys/consoleinterface.h b/src/sys/consoleinterface.h index 6475676..33052cf 100644 --- a/src/sys/consoleinterface.h +++ b/src/sys/consoleinterface.h @@ -66,6 +66,14 @@ public: /// a pointer to the current console instance static ConsoleInterface *instance(); + /// enable or disable rcon + void buffer_rcon(bool enable = true); + + /// return the console inputbuffer + inline std::stringstream & buffer() { return consoleinterface_buffer; } + + inline bool rcon() { return consoleinterface_rcon; } + protected: std::deque<std::string> consoleinterface_text; std::stringstream consoleinterface_buffer; @@ -77,6 +85,7 @@ private: /// console singleton static ConsoleInterface *consoleinterface_instance; bool consoleinterface_ansi; + bool consoleinterface_rcon; }; } // namespace sys |