# HG changeset patch # User unc0rr # Date 1403804616 -14400 # Node ID 16122539d2eab0b9c7fb56a89891ba661a925074 # Parent 22e441db6343e3f6ff491ab5aaa4d3c708f841ec Fix build, and also make protocol a bit more consistent and flexible (only in docs though, to be implemented) diff -r 22e441db6343 -r 16122539d2ea doc/protocol.txt --- a/doc/protocol.txt Thu Jun 26 00:48:44 2014 +0400 +++ b/doc/protocol.txt Thu Jun 26 21:43:36 2014 +0400 @@ -18,14 +18,15 @@ 'E' + <текст> сообщение об ошибке ',' /skip 't' + № /taunt № - 'g' + teams of user 'nick' are controlled again (synced msg) + 'f' + 'team' is uncontrolled + 'g' + 'team' is controlled again (synced msg) фронтенд клиенту: 'e' + <команда> выполнить "/<команда>" 'T' + {L,N,D} тип игры (локальная, сетевая, просмотр демо) 'W' + <текст> сообщение о нефатальной ошибке 'F' + команда team вылетела в сетевой игре - 'G' + user 'nick' is back (unsynced msg) + 'G' + 'team' is back (unsynced msg) 'o' stop syncing, game over! Клиент фронтенду: diff -r 22e441db6343 -r 16122539d2ea gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Thu Jun 26 00:48:44 2014 +0400 +++ b/gameServer/HWProtoLobbyState.hs Thu Jun 26 21:43:36 2014 +0400 @@ -50,6 +50,7 @@ handleCmd_lobby ["JOIN_ROOM", roomName, roomPassword] = do (_, irnc) <- ask + let ris = allRooms irnc cl <- thisClient let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris @@ -61,7 +62,11 @@ let owner = find isMaster jRoomClients let chans = map sendChan (cl : jRoomClients) let isBanned = host cl `elem` roomBansList jRoom - let hasTeamsInGame = (isJust $ gameInfo jRoom) && (or . map (\t -> teamowner t == nick cl) . teamsAtStart . fromJust $ gameInfo jRoom) + let clTeams = + if (isJust $ gameInfo jRoom) then + map teamname . filter (\t -> teamowner t == nick cl) . teamsAtStart . fromJust $ gameInfo jRoom + else + [] return $ if isNothing maybeRI then [Warning $ loc "No such room"] @@ -88,7 +93,7 @@ ++ answerTeams cl jRoom ++ watchRound cl jRoom chans ++ [AnswerClients [sendChan cl] ["CHAT", "[greeting]", greeting jRoom] | greeting jRoom /= ""] - ++ if hasTeamsInGame then ["EM", toEngineMsg $ 'G' `B.cons` nick cl] else [] + ++ map (\t -> AnswerClients chans ["EM", toEngineMsg $ 'G' `B.cons` t]) clTeams where sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $