Save some more bytes in protocol
authorunc0rr
Fri, 20 Feb 2009 19:47:31 +0000
changeset 1815 3d62cf9c350e
parent 1814 e5391d901cff
child 1816 be39d409b675
Save some more bytes in protocol
QTfrontend/newnetclient.cpp
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
gameServer/stresstest.hs
--- a/QTfrontend/newnetclient.cpp	Fri Feb 20 19:46:22 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Fri Feb 20 19:47:31 2009 +0000
@@ -259,10 +259,10 @@
 		return;
 	}
 
-	if (lst[0] == "CHAT_STRING") {
+	if (lst[0] == "CHAT") {
 		if(lst.size() < 3)
 		{
-			qWarning("Net: Empty CHAT_STRING message");
+			qWarning("Net: Empty CHAT message");
 			return;
 		}
 		if (netClientState == 2)
@@ -669,7 +669,7 @@
 void HWNewNet::chatLineToNet(const QString& str)
 {
 	if(str != "") {
-		RawSendNet(QString("CHAT_STRING") + delimeter + str);
+		RawSendNet(QString("CHAT") + delimeter + str);
 		emit(chatStringFromMe(formatChatMsg(mynick, str)));
 	}
 }
@@ -677,7 +677,7 @@
 void HWNewNet::chatLineToLobby(const QString& str)
 {
 	if(str != "") {
-		RawSendNet(QString("CHAT_STRING") + delimeter + str);
+		RawSendNet(QString("CHAT") + delimeter + str);
 		emit(chatStringFromMeLobby(formatChatMsg(mynick, str)));
 	}
 }
--- a/gameServer/HWProtoInRoomState.hs	Fri Feb 20 19:46:22 2009 +0000
+++ b/gameServer/HWProtoInRoomState.hs	Fri Feb 20 19:47:31 2009 +0000
@@ -13,8 +13,8 @@
 
 handleCmd_inRoom :: CmdHandler
 
-handleCmd_inRoom clID clients _ ["CHAT_STRING", msg] =
-	[AnswerOthersInRoom ["CHAT_STRING", clientNick, msg]]
+handleCmd_inRoom clID clients _ ["CHAT", msg] =
+	[AnswerOthersInRoom ["CHAT", clientNick, msg]]
 	where
 		clientNick = nick $ clients IntMap.! clID
 
--- a/gameServer/HWProtoLobbyState.hs	Fri Feb 20 19:46:22 2009 +0000
+++ b/gameServer/HWProtoLobbyState.hs	Fri Feb 20 19:47:31 2009 +0000
@@ -34,8 +34,8 @@
 				show $ gameinprogress room
 				]
 
-handleCmd_lobby clID clients _ ["CHAT_STRING", msg] =
-	[AnswerOthersInRoom ["CHAT_STRING", clientNick, msg]]
+handleCmd_lobby clID clients _ ["CHAT", msg] =
+	[AnswerOthersInRoom ["CHAT", clientNick, msg]]
 	where
 		clientNick = nick $ clients IntMap.! clID
 
--- a/gameServer/stresstest.hs	Fri Feb 20 19:46:22 2009 +0000
+++ b/gameServer/stresstest.hs	Fri Feb 20 19:47:31 2009 +0000
@@ -14,9 +14,9 @@
 import System.Posix
 #endif
 
-session1 nick room = ["NICK", nick, "", "PROTO", "24", "", "CHAT_STRING", "lobby 1", "", "CREATE", room, "", "CHAT_STRING", "room 1", "", "QUIT", "bye-bye", ""]
-session2 nick room = ["NICK", nick, "", "PROTO", "24", "", "LIST", "", "JOIN", room, "", "CHAT_STRING", "room 2", "", "PART", "", "CHAT_STRING", "lobby after part", "", "QUIT", "bye-bye", ""]
-session3 nick room = ["NICK", nick, "", "PROTO", "24", "", "LIST", "", "JOIN", room, "", "CHAT_STRING", "room 2", "", "QUIT", "bye-bye", ""]
+session1 nick room = ["NICK", nick, "", "PROTO", "24", "", "CHAT", "lobby 1", "", "CREATE", room, "", "CHAT", "room 1", "", "QUIT", "bye-bye", ""]
+session2 nick room = ["NICK", nick, "", "PROTO", "24", "", "LIST", "", "JOIN", room, "", "CHAT", "room 2", "", "PART", "", "CHAT", "lobby after part", "", "QUIT", "bye-bye", ""]
+session3 nick room = ["NICK", nick, "", "PROTO", "24", "", "LIST", "", "JOIN", room, "", "CHAT", "room 2", "", "QUIT", "bye-bye", ""]
 
 emulateSession sock s = do
 	mapM_ (\x -> hPutStrLn sock x >> hFlush sock >> randomRIO (50000::Int, 90000) >>= threadDelay) s