From 1c5103e891399fecbe68a72fada11b5dd5c10ce4 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 16 Mar 2008 22:48:02 +0000 Subject: fixed the chatting --- src/engine/e_if_inp.h | 2 +- src/game/client/gc_client.cpp | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/engine/e_if_inp.h b/src/engine/e_if_inp.h index 8e0ea2c2..00f44ba1 100644 --- a/src/engine/e_if_inp.h +++ b/src/engine/e_if_inp.h @@ -20,7 +20,7 @@ enum typedef struct { int flags; - char ch; + unsigned char ch; int key; } INPUT_EVENT; diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 2526ab83..580eb302 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -718,13 +718,16 @@ void chat_say(int team, const char *line) void chat_enable_mode(int team) { - if(team) - chat_mode = CHATMODE_TEAM; - else - chat_mode = CHATMODE_ALL; - - mem_zero(chat_input, sizeof(chat_input)); - chat_input_len = 0; + if(chat_mode == CHATMODE_NONE) + { + if(team) + chat_mode = CHATMODE_TEAM; + else + chat_mode = CHATMODE_ALL; + + mem_zero(chat_input, sizeof(chat_input)); + chat_input_len = 0; + } } void render_game() @@ -801,7 +804,7 @@ void render_game() for(int i = 0; i < inp_num_events(); i++) { INPUT_EVENT e = inp_get_event(i); - + if (!(e.ch >= 0 && e.ch < 32)) { if (chat_input_len < sizeof(chat_input) - 1) @@ -812,7 +815,7 @@ void render_game() } } - if(e.key == KEY_BACKSPACE) + if(e.key == KEY_BACKSPACE && (e.flags&INPFLAG_PRESS)) { if(chat_input_len > 0) { -- cgit 1.4.1