gameServer/Utils.hs
changeset 2309 1c106b0d36da
parent 2305 a51f5f88f3cf
child 2310 581e59f123a2
equal deleted inserted replaced
2308:4c39fb2bea6e 2309:1c106b0d36da
    39 	where
    39 	where
    40 		decoded = fromEngineMsg msg
    40 		decoded = fromEngineMsg msg
    41 		test Nothing = False
    41 		test Nothing = False
    42 		test (Just (m:ms)) = m `Set.member` legalMessages
    42 		test (Just (m:ms)) = m `Set.member` legalMessages
    43 		test _ = False
    43 		test _ = False
    44 		legalMessages = Set.fromList $ "M#+RrUuDdZzAaSjJ,sFNpPwtghb12345" ++ slotMessages
    44 		legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghb12345" ++ slotMessages
    45 		slotMessages = ['\128', '\129', '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', '\138']
    45 		slotMessages = ['\128', '\129', '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', '\138']
    46 
    46 
    47 maybeRead :: Read a => String -> Maybe a
    47 maybeRead :: Read a => String -> Maybe a
    48 maybeRead s = case reads s of
    48 maybeRead s = case reads s of
    49 	[(x, rest)] | all isSpace rest -> Just x
    49 	[(x, rest)] | all isSpace rest -> Just x