gameServer/Votes.hs
changeset 10195 d1c23bb73346
parent 10090 a471a7bbc339
child 10212 5fb3bb2de9d2
equal deleted inserted replaced
10194:7025bd3c3131 10195:d1c23bb73346
     4 import Control.Monad.Reader
     4 import Control.Monad.Reader
     5 import Control.Monad.State
     5 import Control.Monad.State
     6 import ServerState
     6 import ServerState
     7 import qualified Data.ByteString.Char8 as B
     7 import qualified Data.ByteString.Char8 as B
     8 import qualified Data.List as L
     8 import qualified Data.List as L
       
     9 import qualified Data.Map as Map
     9 import Data.Maybe
    10 import Data.Maybe
    10 -------------------
    11 -------------------
    11 import Utils
    12 import Utils
    12 import CoreTypes
    13 import CoreTypes
    13 import HandlerUtils
    14 import HandlerUtils
    59             [KickRoomClient kickId |
    60             [KickRoomClient kickId |
    60                 isJust maybeClientId
    61                 isJust maybeClientId
    61                 && sameRoom
    62                 && sameRoom
    62                 && ((isNothing $ gameInfo rm) || teamsInGame kickCl == 0)
    63                 && ((isNothing $ gameInfo rm) || teamsInGame kickCl == 0)
    63             ]
    64             ]
       
    65     act (VoteMap roomSave) = do
       
    66         rm <- thisRoom
       
    67         let rs = Map.lookup roomSave (roomSaves rm)
       
    68         case rs of
       
    69              Nothing -> return []
       
    70              Just (mp, p) -> return [ModifyRoom $ \r -> r{params = p, mapParams = mp}]
    64 
    71 
    65 
    72 
    66 startVote :: VoteType -> Reader (ClientIndex, IRnC) [Action]
    73 startVote :: VoteType -> Reader (ClientIndex, IRnC) [Action]
    67 startVote vt = do
    74 startVote vt = do
    68     (ci, rnc) <- ask
    75     (ci, rnc) <- ask
    84 checkVotes = undefined
    91 checkVotes = undefined
    85 
    92 
    86 
    93 
    87 voteInfo :: VoteType -> B.ByteString
    94 voteInfo :: VoteType -> B.ByteString
    88 voteInfo (VoteKick n) = B.concat [loc "kick", " ", n]
    95 voteInfo (VoteKick n) = B.concat [loc "kick", " ", n]
    89 
    96 voteInfo (VoteMap n) = B.concat [loc "map", " ", n]