Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-07-05 15:38:59 +0000
committerStijn Buys <ingar@osirion.org>2008-07-05 15:38:59 +0000
commitcb1b7572369eebbd47efc9851afc8446dbe2f08a (patch)
tree8e3d7849bce4eba6d80df575e6b01653819efef3 /src/sys
parente5aada2bf01e51753829215c0a3035aa8bd8135a (diff)
enable Shared functions, rcon API
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/consoleinterface.cc14
-rw-r--r--src/sys/consoleinterface.h9
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