Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/chat.cc')
-rw-r--r--src/client/chat.cc31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc
index 6fd5008..6c3140d 100644
--- a/src/client/chat.cc
+++ b/src/client/chat.cc
@@ -24,46 +24,23 @@ size_t input_pos = 0;
// chatbox visibility
bool chat_visible = false;
-//--- engine functions --------------------------------------------
-
-void func_con_chat(std::string const &args)
-{
- std::istringstream argstream(args);
- int i;
-
- if (argstream >> i) {
- if (i) chat_visible = true; else chat_visible = false;
- } else
- chat_visible = !chat_visible;
-
-
-}
-
//--- public ------------------------------------------------------
void init()
{
// add engine functions
- core::Func *func = core::Func::add("ui_chat", (core::FuncPtr) func_con_chat);
- func->set_info("toggle chatbox");
-
history.clear();
history.push_back("");
history_pos = history.rbegin();
input_pos = 0;
-
}
void shutdown()
{
- // remove engine functions
- core::Func::remove("ui_chat");
-
history.clear();
input_pos = 0;
}
-
bool visible()
{
return chat_visible;
@@ -133,14 +110,18 @@ void toggle()
(*history_pos).clear();
}
- setkeyboardmode(chat_visible);
+ setkeyboardmode(console()->visible() || (core::application()->connected() && chat::visible()));
}
-void keypressed(int key)
+void keypressed(unsigned int key)
{
std::deque<std::string>::reverse_iterator upit;
switch( key ) {
+ case SDLK_ESCAPE:
+ toggle();
+ break;
+
case SDLK_TAB:
core::CommandBuffer::complete( (*history_pos), input_pos);
break;