gameServer/Actions.hs
changeset 2408 41ebdb5f1e6e
parent 2403 6c5d504af2ba
child 2551 01eb81cd3198
equal deleted inserted replaced
2407:9f413bd5150e 2408:41ebdb5f1e6e
   248 			processAction (newMasterId, serverInfo, clients, rooms) $ AnswerThisClient ["ROOM_CONTROL_ACCESS", "1"]
   248 			processAction (newMasterId, serverInfo, clients, rooms) $ AnswerThisClient ["ROOM_CONTROL_ACCESS", "1"]
   249 			return (
   249 			return (
   250 				clID,
   250 				clID,
   251 				serverInfo,
   251 				serverInfo,
   252 				adjust (\cl -> cl{isMaster = True}) newMasterId clients,
   252 				adjust (\cl -> cl{isMaster = True}) newMasterId clients,
   253 				adjust (\r -> r{name = newRoomName}) rID rooms
   253 				adjust (\r -> r{masterID = newMasterId, name = newRoomName}) rID rooms
   254 				)
   254 				)
   255 		newRoomName = nick newMasterClient
   255 		newRoomName = nick newMasterClient
   256 		otherPlayersSet = IntSet.delete clID (playersIDs room)
   256 		otherPlayersSet = IntSet.delete clID (playersIDs room)
   257 		newMasterId = IntSet.findMin otherPlayersSet
   257 		newMasterId = IntSet.findMin otherPlayersSet
   258 		newMasterClient = clients ! newMasterId
   258 		newMasterClient = clients ! newMasterId
   260 
   260 
   261 processAction (clID, serverInfo, clients, rooms) (AddRoom roomName roomPassword) = do
   261 processAction (clID, serverInfo, clients, rooms) (AddRoom roomName roomPassword) = do
   262 	let newServerInfo = serverInfo {nextRoomID = newID}
   262 	let newServerInfo = serverInfo {nextRoomID = newID}
   263 	let room = newRoom{
   263 	let room = newRoom{
   264 			roomUID = newID,
   264 			roomUID = newID,
       
   265 			masterID = clID,
   265 			name = roomName,
   266 			name = roomName,
   266 			password = roomPassword,
   267 			password = roomPassword,
   267 			roomProto = (clientProto client)
   268 			roomProto = (clientProto client)
   268 			}
   269 			}
   269 
   270