9 |
9 |
10 teamToNet team = ["ADD_TEAM", teamname team, teamgrave team, teamfort team, show $ difficulty team] ++ hhsInfo |
10 teamToNet team = ["ADD_TEAM", teamname team, teamgrave team, teamfort team, show $ difficulty team] ++ hhsInfo |
11 where |
11 where |
12 hhsInfo = concatMap (\(HedgehogInfo name hat) -> [name, hat]) $ hedgehogs team |
12 hhsInfo = concatMap (\(HedgehogInfo name hat) -> [name, hat]) $ hedgehogs team |
13 |
13 |
|
14 answerServerMessage = [(clientOnly, ["SERVER_MESSAGE", "<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"])] |
14 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])] |
15 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])] |
15 answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])] |
16 answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])] |
16 answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])] |
17 answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])] |
17 answerQuit = [(clientOnly, ["off"])] |
18 answerQuit = [(clientOnly, ["off"])] |
18 answerAbandoned = [(othersInRoom, ["BYE"])] |
19 answerAbandoned = [(othersInRoom, ["BYE"])] |
101 |
102 |
102 |
103 |
103 -- 'noRoom' clients state command handlers |
104 -- 'noRoom' clients state command handlers |
104 handleCmd_noRoom :: CmdHandler |
105 handleCmd_noRoom :: CmdHandler |
105 handleCmd_noRoom client _ rooms ["LIST"] = |
106 handleCmd_noRoom client _ rooms ["LIST"] = |
106 (noChangeClients, noChangeRooms, answerRoomsList $ map name rooms) |
107 (noChangeClients, noChangeRooms, answerServerMessage ++ (answerRoomsList $ map name rooms)) |
107 |
108 |
108 handleCmd_noRoom client _ rooms ["CREATE", newRoom, roomPassword] = |
109 handleCmd_noRoom client _ rooms ["CREATE", newRoom, roomPassword] = |
109 if haveSameRoom then |
110 if haveSameRoom then |
110 (noChangeClients, noChangeRooms, answerRoomExists) |
111 (noChangeClients, noChangeRooms, answerRoomExists) |
111 else |
112 else |