gameServer/Votes.hs
changeset 10212 5fb3bb2de9d2
parent 10195 d1c23bb73346
child 10215 26fc5502ba22
--- a/gameServer/Votes.hs	Thu Mar 20 22:14:30 2014 +0400
+++ b/gameServer/Votes.hs	Sun Mar 23 23:35:33 2014 +0400
@@ -31,7 +31,7 @@
     where
     actOnVoting :: Voting -> Reader (ClientIndex, IRnC) [Action]
     actOnVoting vt = do
-        let (contra, pro) = L.partition snd $ votes vt
+        let (pro, contra) = L.partition snd $ votes vt
         let v = (length $ entitledToVote vt) `div` 2 + 1
 
         if length contra >= v then
@@ -67,7 +67,7 @@
         let rs = Map.lookup roomSave (roomSaves rm)
         case rs of
              Nothing -> return []
-             Just (mp, p) -> return [ModifyRoom $ \r -> r{params = p, mapParams = mp}]
+             Just (mp, p) -> return [Warning "ye!", ModifyRoom $ \r -> r{params = p, mapParams = mp}]
 
 
 startVote :: VoteType -> Reader (ClientIndex, IRnC) [Action]
@@ -82,9 +82,11 @@
     if isJust $ voting rm then
         return []
     else
-        liftM ([ModifyRoom (\r -> r{voting = Just (newVoting vt){entitledToVote = uids}})
-        , AnswerClients chans ["CHAT", "[server]", B.concat [loc "New voting started", ": ", voteInfo vt]]
-        ] ++ ) $ voted True
+        return [
+            ModifyRoom (\r -> r{voting = Just (newVoting vt){entitledToVote = uids}})
+            , AnswerClients chans ["CHAT", "[server]", B.concat [loc "New voting started", ": ", voteInfo vt]]
+            , ReactCmd ["VOTE", "YES"]
+        ] 
 
 
 checkVotes :: StateT ServerState IO ()