From da0715c2648b662892a72e32e8528a08608d0d0b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 31 May 2008 09:02:50 +0000 Subject: chatbox accepts console commands --- src/client/chat.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/client/chat.cc') 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(""); -- cgit v1.2.3