gameServer/Utils.hs
changeset 4570 fa19f0579083
parent 4568 f85243bf890e
child 4693 6f74c97147fe
equal deleted inserted replaced
4568:f85243bf890e 4570:fa19f0579083
    44     where
    44     where
    45         decoded = fromEngineMsg msg
    45         decoded = fromEngineMsg msg
    46         check Nothing = (False, False)
    46         check Nothing = (False, False)
    47         check (Just (m:ms)) = (m `Set.member` legalMessages, m == '+')
    47         check (Just (m:ms)) = (m `Set.member` legalMessages, m == '+')
    48         check _ = (False, False)
    48         check _ = (False, False)
    49         legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghb12345" ++ slotMessages
    49         legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages
    50         slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
    50         slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
    51 
    51 
    52 maybeRead :: Read a => String -> Maybe a
    52 maybeRead :: Read a => String -> Maybe a
    53 maybeRead s = case reads s of
    53 maybeRead s = case reads s of
    54     [(x, rest)] | all isSpace rest -> Just x
    54     [(x, rest)] | all isSpace rest -> Just x