--- a/netserver/HWProto.hs Fri Oct 24 14:28:47 2008 +0000
+++ b/netserver/HWProto.hs Fri Oct 24 15:02:26 2008 +0000
@@ -245,13 +245,15 @@
clRoom = roomByName (room client) rooms
newReadyPlayers = (readyPlayers clRoom) + if isReady client then -1 else 1
-handleCmd_inRoom client _ rooms ["ROUNDFINISHED"] =
+handleCmd_inRoom client clients rooms ["ROUNDFINISHED"] =
if isMaster client then
- (noChangeClients, modifyRoom clRoom{gameinprogress = False}, [])
+ (modifyRoomClients clRoom (\cl -> cl{isReady = False}), modifyRoom clRoom{gameinprogress = False, readyPlayers = 0}, answerAllNotReady)
else
(noChangeClients, noChangeRooms, [])
where
clRoom = roomByName (room client) rooms
+ sameRoomClients = filter (\ci -> room ci == name clRoom) clients
+ answerAllNotReady = map (\cl -> (sameRoom, ["NOT_READY", nick cl])) sameRoomClients
handleCmd_inRoom client _ _ ["GAMEMSG", msg] =
(noChangeClients, noChangeRooms, [(othersInRoom, ["GAMEMSG", msg])])
--- a/netserver/Miscutils.hs Fri Oct 24 14:28:47 2008 +0000
+++ b/netserver/Miscutils.hs Fri Oct 24 15:02:26 2008 +0000
@@ -102,6 +102,9 @@
else
cl : (modifyClient client cls)
+modifyRoomClients :: RoomInfo -> (ClientInfo -> ClientInfo) -> ClientsTransform
+modifyRoomClients clientsroom clientMod clients = map (\c -> if name clientsroom == room c then clientMod c else c) clients
+
noChangeRooms :: RoomsTransform
noChangeRooms a = a