# HG changeset patch # User unc0rr # Date 1254934900 0 # Node ID 41ebdb5f1e6e08247e113554710ce778839fc0b3 # Parent 9f413bd5150ecdf405c5410b080cd5b305c27778 Server provides more info in rooms list diff -r 9f413bd5150e -r 41ebdb5f1e6e gameServer/Actions.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) diff -r 9f413bd5150e -r 41ebdb5f1e6e gameServer/CoreTypes.hs --- 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 diff -r 9f413bd5150e -r 41ebdb5f1e6e gameServer/HWProtoInRoomState.hs --- 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)] diff -r 9f413bd5150e -r 41ebdb5f1e6e gameServer/HWProtoLobbyState.hs --- 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]]