gameServer/ServerCore.hs
changeset 1926 cb46fbdcaa41
parent 1841 fba7210b438b
child 1927 e2031906a347
equal deleted inserted replaced
1925:ec923e56c444 1926:cb46fbdcaa41
    27 	r <- readChan $ coreChan serverInfo
    27 	r <- readChan $ coreChan serverInfo
    28 	
    28 	
    29 	(newServerInfo, mClients, mRooms) <-
    29 	(newServerInfo, mClients, mRooms) <-
    30 		case r of
    30 		case r of
    31 			Accept ci -> do
    31 			Accept ci -> do
    32 				let updatedClients = IntMap.insert (clientUID ci) ci clients
       
    33 				infoM "Clients" ("New client: id " ++ (show $ clientUID ci))
       
    34 				liftM firstAway $ processAction
    32 				liftM firstAway $ processAction
    35 					(clientUID ci, serverInfo, updatedClients, rooms)
    33 					(clientUID ci, serverInfo, clients, rooms) (AddClient ci)
    36 					(AnswerThisClient ["CONNECTED", "Hedgewars server http://www.hedgewars.org/"])
       
    37 
    34 
    38 			ClientMessage (clID, cmd) -> do
    35 			ClientMessage (clID, cmd) -> do
    39 				debugM "Clients" $ (show clID) ++ ": " ++ (show cmd)
    36 				debugM "Clients" $ (show clID) ++ ": " ++ (show cmd)
    40 				if clID `IntMap.member` clients then
    37 				if clID `IntMap.member` clients then
    41 					reactCmd serverInfo clID cmd clients rooms
    38 					reactCmd serverInfo clID cmd clients rooms
    77 	forkIO $ timerLoop messagesChan-}
    74 	forkIO $ timerLoop messagesChan-}
    78 
    75 
    79 	startDBConnection $ serverInfo
    76 	startDBConnection $ serverInfo
    80 
    77 
    81 	mainLoop serverInfo IntMap.empty (IntMap.singleton 0 newRoom)
    78 	mainLoop serverInfo IntMap.empty (IntMap.singleton 0 newRoom)
    82 
       
    83 
       
    84