Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-31 09:02:50 +0000
committerStijn Buys <ingar@osirion.org>2008-05-31 09:02:50 +0000
commitda0715c2648b662892a72e32e8528a08608d0d0b (patch)
tree727e2aa37620dd932700b407ee1749e4ab1c1793 /src
parent8933b795003f8ad202fce6e553191be8932a37b6 (diff)
chatbox accepts console commands
Diffstat (limited to 'src')
-rw-r--r--src/client/chat.cc11
-rw-r--r--src/client/console.cc6
-rw-r--r--src/client/input.cc2
3 files changed, 13 insertions, 6 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc
index 9171387..6fd5008 100644
--- a/src/client/chat.cc
+++ b/src/client/chat.cc
@@ -44,7 +44,8 @@ void func_con_chat(std::string const &args)
void init()
{
// add engine functions
- core::Func::add("con_chat", (core::FuncPtr) func_con_chat);
+ core::Func *func = core::Func::add("ui_chat", (core::FuncPtr) func_con_chat);
+ func->set_info("toggle chatbox");
history.clear();
history.push_back("");
@@ -56,7 +57,7 @@ void init()
void shutdown()
{
// remove engine functions
- //core::Func::remove("con_chat");
+ core::Func::remove("ui_chat");
history.clear();
input_pos = 0;
@@ -150,7 +151,11 @@ void keypressed(int key)
history.pop_front();
}
- core::cmd() << "say " << (*history_pos) << std::endl;
+ if ((*history_pos).c_str()[0] == '/' || (*history_pos).c_str()[0] == '\\') {
+ core::cmd() << &(*history_pos).c_str()[1] << std::endl;
+ } else {
+ core::cmd() << "say " << (*history_pos) << std::endl;
+ }
(*history.rbegin()) = (*history_pos);
history.push_back("");
diff --git a/src/client/console.cc b/src/client/console.cc
index 8eab607..a09272a 100644
--- a/src/client/console.cc
+++ b/src/client/console.cc
@@ -27,7 +27,7 @@ Console *console() {
//--- engine functions --------------------------------------------
-void func_con_toggle(std::string const &args)
+void func_ui_console(std::string const &args)
{
console()->toggle();
@@ -39,7 +39,7 @@ void Console::init()
{
con_print << "^BInitializing console..." << std::endl;
- core::Func *func = core::Func::add("con_toggle", (core::FuncPtr) func_con_toggle);
+ core::Func *func = core::Func::add("ui_console", (core::FuncPtr) func_ui_console);
func->set_info("toggle console on or off");
console()->load_history();
}
@@ -51,7 +51,7 @@ void Console::shutdown()
console()->save_history();
// remove engine functions
- core::Func::remove("con_toggle");
+ core::Func::remove("ui_console");
}
//--- Console -----------------------------------------------------
diff --git a/src/client/input.cc b/src/client/input.cc
index 22db6bc..d594dbf 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -241,8 +241,10 @@ void frame(float seconds)
//last_control = 0;
console()->toggle();
+ /*
if (console()->visible() && chat::visible())
chat::toggle();
+ */
} else if (console()->visible()) {
// send key events to the console
console()->keypressed(translate_keysym(event.key.keysym));