Cut the length of most used net packet
authorunc0rr
Sat, 07 Mar 2009 17:43:25 +0000
changeset 1866 36aa0ca6e8af
parent 1865 ebc6dfca60d4
child 1867 2fc0e1e39b11
Cut the length of most used net packet
QTfrontend/newnetclient.cpp
gameServer/Actions.hs
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
share/hedgewars/Data/Graphics/Hedgehog/Invulnerable.png
--- a/QTfrontend/newnetclient.cpp	Sat Mar 07 17:42:54 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Sat Mar 07 17:43:25 2009 +0000
@@ -137,7 +137,7 @@
 {
   QString msg = QString(buf.toBase64());
 
-  RawSendNet(QString("GAMEMSG%1%2").arg(delimeter).arg(msg));
+  RawSendNet(QString("EM%1%2").arg(delimeter).arg(msg));
 }
 
 void HWNewNet::RawSendNet(const QString & str)
@@ -543,10 +543,10 @@
 		return;
 	}
 
-	if (lst[0] == "GAMEMSG") {
+	if (lst[0] == "EM") {
 		if(lst.size() < 2)
 		{
-			qWarning("Net: Bad GAMEMSG message");
+			qWarning("Net: Bad EM message");
 			return;
 		}
 		for(int i = 1; i < lst.size(); ++i)
--- a/gameServer/Actions.hs	Sat Mar 07 17:42:54 2009 +0000
+++ b/gameServer/Actions.hs	Sat Mar 07 17:43:25 2009 +0000
@@ -28,6 +28,7 @@
 	| Warning String
 	| ByeClient String
 	| KickClient Int -- clID
+	| BanClient String -- nick
 	| ModifyClient (ClientInfo -> ClientInfo)
 	| ModifyRoom (RoomInfo -> RoomInfo)
 	| AddRoom String String
@@ -232,7 +233,7 @@
 				adjust (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r}) rID rooms
 		else
 			do
-			processAction (clID, serverInfo, clients, rooms) $ AnswerOthersInRoom ["GAMEMSG", rmTeamMsg]
+			processAction (clID, serverInfo, clients, rooms) $ AnswerOthersInRoom ["EM", rmTeamMsg]
 			return $
 				adjust (\r -> r{
 				teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r,
--- a/gameServer/HWProtoInRoomState.hs	Sat Mar 07 17:42:54 2009 +0000
+++ b/gameServer/HWProtoInRoomState.hs	Sat Mar 07 17:43:25 2009 +0000
@@ -152,9 +152,9 @@
 		enoughClans = not $ null $ drop 1 $ group $ map teamcolor $ teams room
 
 
-handleCmd_inRoom _ _ rooms ["GAMEMSG", msg] =
+handleCmd_inRoom _ _ rooms ["EM", msg] =
 	[ModifyRoom (\r -> r{roundMsgs = roundMsgs r |> msg}),
-	AnswerOthersInRoom ["GAMEMSG", msg]]
+	AnswerOthersInRoom ["EM", msg]]
 
 
 handleCmd_inRoom clID clients rooms ["ROUNDFINISHED"] =
--- a/gameServer/HWProtoLobbyState.hs	Sat Mar 07 17:42:54 2009 +0000
+++ b/gameServer/HWProtoLobbyState.hs	Sat Mar 07 17:43:25 2009 +0000
@@ -96,7 +96,7 @@
 					[]
 				else
 					[AnswerThisClient  ["RUN_GAME"],
-					AnswerThisClient $ "GAMEMSG" : toEngineMsg "e$spectate 1" : (Foldable.toList $ roundMsgs jRoom)]
+					AnswerThisClient $ "EM" : toEngineMsg "e$spectate 1" : (Foldable.toList $ roundMsgs jRoom)]
 
 		answerTeams = if gameinprogress jRoom then
 				answerAllTeams (teamsAtStart jRoom)
@@ -124,8 +124,15 @@
 		maybeClient = Foldable.find (\cl -> kickNick == nick cl) clients
 		noSuchClient = isNothing maybeClient
 		kickID = clientUID $ fromJust maybeClient
-	--	room = rooms IntMap.! roomID client
-	--	roomInfo = if roomID client /= 0 then "room " ++ (name room) else "lobby"
+
+
+handleCmd_lobby clID clients rooms ["BAN", banNick] =
+	if not $ isAdministrator client then
+		[]
+	else
+		BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick]
+	where
+		client = clients IntMap.! clID
 
 
 handleCmd_lobby clID _ _ _ = [ProtocolError "Incorrect command (state: in lobby)"]
Binary file share/hedgewars/Data/Graphics/Hedgehog/Invulnerable.png has changed