netserver/HWProto.hs
changeset 1469 5218aa76939e
parent 1462 d3323637da1f
child 1470 ebaca3b66d92
equal deleted inserted replaced
1468:6e6a75de2fc9 1469:5218aa76939e
    61 answerIsReady nick = [(sameRoom, ["READY", nick])]
    61 answerIsReady nick = [(sameRoom, ["READY", nick])]
    62 answerNotReady nick = [(sameRoom, ["NOT_READY", nick])]
    62 answerNotReady nick = [(sameRoom, ["NOT_READY", nick])]
    63 answerTooFewClans = [(clientOnly, ["ERROR", "Too few clans in game"])]
    63 answerTooFewClans = [(clientOnly, ["ERROR", "Too few clans in game"])]
    64 answerRestricted = [(clientOnly, ["WARNING", "Room joining restricted"])]
    64 answerRestricted = [(clientOnly, ["WARNING", "Room joining restricted"])]
    65 answerPing = [(allClients, ["PING"])]
    65 answerPing = [(allClients, ["PING"])]
       
    66 answerConnected = [(clientOnly, ["CONNECTED", "Hedgewars server http://www.hedgewars.org/"])]
    66 
    67 
    67 -- Main state-independent cmd handler
    68 -- Main state-independent cmd handler
    68 handleCmd :: CmdHandler
    69 handleCmd :: CmdHandler
    69 handleCmd client _ rooms ("QUIT":xs) =
    70 handleCmd client _ rooms ("QUIT":xs) =
    70 	if null (room client) then
    71 	if null (room client) then
    79 		(clientTeams, othersTeams) = partition (\t -> teamowner t == nick client) $ teams clRoom
    80 		(clientTeams, othersTeams) = partition (\t -> teamowner t == nick client) $ teams clRoom
    80 		newReadyPlayers = if isReady client then (readyPlayers clRoom) - 1 else readyPlayers clRoom
    81 		newReadyPlayers = if isReady client then (readyPlayers clRoom) - 1 else readyPlayers clRoom
    81 
    82 
    82 handleCmd _ _ _ ["PING"] = -- core requsted
    83 handleCmd _ _ _ ["PING"] = -- core requsted
    83 	(noChangeClients, noChangeRooms, answerPing)
    84 	(noChangeClients, noChangeRooms, answerPing)
       
    85 
       
    86 handleCmd _ _ _ ["ASKME"] = -- core requsted
       
    87 	(noChangeClients, noChangeRooms, answerConnected)
    84 
    88 
    85 handleCmd _ _ _ ["PONG"] =
    89 handleCmd _ _ _ ["PONG"] =
    86 	(noChangeClients, noChangeRooms, [])
    90 	(noChangeClients, noChangeRooms, [])
    87 
    91 
    88 -- check state and call state-dependent commmand handlers
    92 -- check state and call state-dependent commmand handlers