netserver/HWProto.hs
changeset 1408 fab171a17968
parent 1407 b44fbb630fb6
child 1411 df78c9571bc7
equal deleted inserted replaced
1407:b44fbb630fb6 1408:fab171a17968
   243 			(modifyClient client{isReady = True}, modifyRoom clRoom{readyPlayers = newReadyPlayers}, answerIsReady $ nick client)
   243 			(modifyClient client{isReady = True}, modifyRoom clRoom{readyPlayers = newReadyPlayers}, answerIsReady $ nick client)
   244 	where
   244 	where
   245 		clRoom = roomByName (room client) rooms
   245 		clRoom = roomByName (room client) rooms
   246 		newReadyPlayers = (readyPlayers clRoom) + if isReady client then -1 else 1
   246 		newReadyPlayers = (readyPlayers clRoom) + if isReady client then -1 else 1
   247 
   247 
   248 handleCmd_inRoom client _ rooms ["ROUNDFINISHED"] =
   248 handleCmd_inRoom client clients rooms ["ROUNDFINISHED"] =
   249 	if isMaster client then
   249 	if isMaster client then
   250 		(noChangeClients, modifyRoom clRoom{gameinprogress = False}, [])
   250 		(modifyRoomClients clRoom (\cl -> cl{isReady = False}), modifyRoom clRoom{gameinprogress = False, readyPlayers = 0}, answerAllNotReady)
   251 	else
   251 	else
   252 		(noChangeClients, noChangeRooms, [])
   252 		(noChangeClients, noChangeRooms, [])
   253 	where
   253 	where
   254 		clRoom = roomByName (room client) rooms
   254 		clRoom = roomByName (room client) rooms
       
   255 		sameRoomClients = filter (\ci -> room ci == name clRoom) clients
       
   256 		answerAllNotReady = map (\cl -> (sameRoom, ["NOT_READY", nick cl])) sameRoomClients
   255 
   257 
   256 handleCmd_inRoom client _ _ ["GAMEMSG", msg] =
   258 handleCmd_inRoom client _ _ ["GAMEMSG", msg] =
   257 	(noChangeClients, noChangeRooms, [(othersInRoom, ["GAMEMSG", msg])])
   259 	(noChangeClients, noChangeRooms, [(othersInRoom, ["GAMEMSG", msg])])
   258 
   260 
   259 handleCmd_inRoom client clients rooms ["KICK", kickNick] =
   261 handleCmd_inRoom client clients rooms ["KICK", kickNick] =