Server provides more info in rooms list
authorunc0rr
Wed, 07 Oct 2009 17:01:40 +0000
changeset 2408 41ebdb5f1e6e
parent 2407 9f413bd5150e
child 2409 dbf195c3e09c
Server provides more info in rooms list
gameServer/Actions.hs
gameServer/CoreTypes.hs
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
--- a/gameServer/Actions.hs	Wed Oct 07 14:37:42 2009 +0000
+++ b/gameServer/Actions.hs	Wed Oct 07 17:01:40 2009 +0000
@@ -250,7 +250,7 @@
 				clID,
 				serverInfo,
 				adjust (\cl -> cl{isMaster = True}) newMasterId clients,
-				adjust (\r -> r{name = newRoomName}) rID rooms
+				adjust (\r -> r{masterID = newMasterId, name = newRoomName}) rID rooms
 				)
 		newRoomName = nick newMasterClient
 		otherPlayersSet = IntSet.delete clID (playersIDs room)
@@ -262,6 +262,7 @@
 	let newServerInfo = serverInfo {nextRoomID = newID}
 	let room = newRoom{
 			roomUID = newID,
+			masterID = clID,
 			name = roomName,
 			password = roomPassword,
 			roomProto = (clientProto client)
--- a/gameServer/CoreTypes.hs	Wed Oct 07 14:37:42 2009 +0000
+++ b/gameServer/CoreTypes.hs	Wed Oct 07 17:01:40 2009 +0000
@@ -64,6 +64,7 @@
 	RoomInfo
 	{
 		roomUID :: !Int,
+		masterID :: !Int,
 		name :: String,
 		password :: String,
 		roomProto :: Word16,
@@ -92,6 +93,7 @@
 newRoom = (
 	RoomInfo
 		0
+		0
 		""
 		""
 		0
--- a/gameServer/HWProtoInRoomState.hs	Wed Oct 07 14:37:42 2009 +0000
+++ b/gameServer/HWProtoInRoomState.hs	Wed Oct 07 17:01:40 2009 +0000
@@ -34,6 +34,7 @@
 
 
 handleCmd_inRoom clID clients rooms ("CFG" : paramName : paramStrs)
+	| null paramStrs = [ProtocolError "Empty config entry"]
 	| isMaster client =
 		[ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)}),
 		AnswerOthersInRoom ("CFG" : paramName : paramStrs)]
--- a/gameServer/HWProtoLobbyState.hs	Wed Oct 07 14:37:42 2009 +0000
+++ b/gameServer/HWProtoLobbyState.hs	Wed Oct 07 17:01:40 2009 +0000
@@ -28,12 +28,22 @@
 		roomsList = IntMap.elems rooms
 		protocol = clientProto client
 		client = clients IntMap.! clID
-		roomInfo room = [
+		roomInfo room
+			| clientProto client < 28 = [
 				name room,
 				show (playersIn room) ++ "(" ++ show (length $ teams room) ++ ")",
 				show $ gameinprogress room
 				]
-
+			| otherwise = [
+				show $ gameinprogress room,
+				name room,
+				show $ playersIn room,
+				show $ length $ teams room,
+				nick $ clients IntMap.! (masterID room),
+				head (Map.findWithDefault ["+gen+"] "MAP" (params room)),
+				head (Map.findWithDefault ["Default"] "SCHEME" (params room)),
+				head (Map.findWithDefault ["Default"] "AMMO" (params room))
+				]
 
 handleCmd_lobby clID clients _ ["CHAT", msg] =
 	[AnswerOthersInRoom ["CHAT", clientNick, msg]]