]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
interactive input, makefile, con_print mutex
authorAkari <hetors.email@gmail.com>
Mon, 7 Feb 2011 10:56:40 +0000 (12:56 +0200)
committerAkari <hetors.email@gmail.com>
Mon, 7 Feb 2011 10:56:40 +0000 (12:56 +0200)
console.c
keys.c
makefile.inc

index 9856e8e3bf307bd482c6f3486447773e75991b26..7f9e44890798dec6b55ed344235541fff1658ae8 100644 (file)
--- a/console.c
+++ b/console.c
@@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // for u8_encodech
 #include "ft2.h"
 
+#include <pthread.h>
+
 float con_cursorspeed = 4;
 
 // lines up from bottom to display
@@ -1041,12 +1043,19 @@ Con_MaskPrint
 extern cvar_t timestamps;
 extern cvar_t timeformat;
 extern qboolean sys_nostdout;
+
+// -- Akari: attempted to make this somewhat thread safe.... works.... sometimes
+
+pthread_mutex_t con_print_mutex = PTHREAD_MUTEX_INITIALIZER;
+
 void Con_MaskPrint(int additionalmask, const char *msg)
 {
        static int mask = 0;
        static int index = 0;
        static char line[MAX_INPUTLINE];
 
+       pthread_mutex_lock(&con_print_mutex);
+
        for (;*msg;msg++)
        {
                Con_Rcon_AddChar(*msg);
@@ -1313,6 +1322,8 @@ void Con_MaskPrint(int additionalmask, const char *msg)
                        mask = 0;
                }
        }
+       
+       pthread_mutex_unlock(&con_print_mutex);
 }
 
 /*
@@ -1736,11 +1747,20 @@ void Con_DrawNotify (void)
 
                // LordHavoc: speedup, and other improvements
                if (chat_mode < 0)
-                       dpsnprintf(temptext, sizeof(temptext), "]%s%s", chat_buffer, cursor);
+                       dpsnprintf(temptext, sizeof(temptext), "]%s%c", chat_buffer, cursor);
+               else if(chat_mode == 2)
+               {
+                       if(chat_buffer[0] == '#' || chat_buffer[0] == '&') //Channels are yellow, nicks are green
+                               dpsnprintf(temptext, sizeof(temptext), "(IRC)target:^3%s^7%c", chat_buffer, cursor);
+                       else
+                               dpsnprintf(temptext, sizeof(temptext), "(IRC)target:^2%s^7%c", chat_buffer, cursor);
+               }
+               else if(chat_mode == 3)
+                       dpsnprintf(temptext, sizeof(temptext), "(IRC)message:%s%c", chat_buffer, cursor);
                else if(chat_mode)
-                       dpsnprintf(temptext, sizeof(temptext), "say_team:%s%s", chat_buffer, cursor);
+                       dpsnprintf(temptext, sizeof(temptext), "say_team:%s%c", chat_buffer, cursor);
                else
-                       dpsnprintf(temptext, sizeof(temptext), "say:%s%s", chat_buffer, cursor);
+                       dpsnprintf(temptext, sizeof(temptext), "say:%s%c", chat_buffer, cursor);
 
                // FIXME word wrap
                inputsize = (numChatlines ? con_chatsize : con_notifysize).value;
diff --git a/keys.c b/keys.c
index 87663328ece11b31d9580e3c74662ed96e263b6a..5a4b694f03652edf2c59143cd9a3b5681d7c8d8d 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1164,6 +1164,10 @@ unsigned int     chat_bufferlen = 0;
 
 extern int Nicks_CompleteChatLine(char *buffer, size_t size, unsigned int pos);
 
+extern void Irc_SetLastChannel(const char *value);
+extern const char* Irc_GetLastChannel();
+extern void Irc_SendMessage(const char *msg);
+
 static void
 Key_Message (int key, int ascii)
 {
@@ -1171,10 +1175,19 @@ Key_Message (int key, int ascii)
        {
                if(chat_mode < 0)
                        Cmd_ExecuteString(chat_buffer, src_command); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
+               else if(chat_mode == 2)
+                       Irc_SetLastChannel(chat_buffer);
+               else if(chat_mode == 3)
+                       Irc_SendMessage(chat_buffer);
                else
                        Cmd_ForwardStringToServer(va("%s %s", chat_mode ? "say_team" : "say ", chat_buffer));
 
-               key_dest = key_game;
+               //after IRC target input, go to message input
+               if(chat_mode != 2)
+                       key_dest = key_game;
+               else
+                       chat_mode = 3;
+                       
                chat_bufferlen = 0;
                chat_buffer[0] = 0;
                return;
index a85df801b639846d8c84941d320f58f9bf46782e..1c67d604db22e93274f8c082d005abefc472b6b9 100644 (file)
@@ -213,7 +213,7 @@ DO_CC=$(CC) $(CFLAGS) -c $< -o $@
 # Link
 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=debug
 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=profile
-LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=release
+LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=release -lircclient
 
 
 ##### UNIX specific variables #####