equal
deleted
inserted
replaced
52 } |
52 } |
53 ) |
53 ) |
54 , AnswerClients chans ["RUN_GAME"] |
54 , AnswerClients chans ["RUN_GAME"] |
55 , SendUpdateOnThisRoom |
55 , SendUpdateOnThisRoom |
56 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks |
56 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks |
57 , ModifyRoomClients (\c -> c{isInGame = True}) |
57 , ModifyRoomClients (\c -> c{isInGame = True, teamIndexes = map snd . filter (\(t, _) -> teamowner t == nick c) $ zip (teams rm) [0..]}) |
58 ] |
58 ] |
59 else |
59 else |
60 return [Warning $ loc "Less than two clans!"] |
60 return [Warning $ loc "Less than two clans!"] |
61 else |
61 else |
62 return [] |
62 return [] |
258 handleCmd_inRoom ["EM", msg] = do |
258 handleCmd_inRoom ["EM", msg] = do |
259 cl <- thisClient |
259 cl <- thisClient |
260 rm <- thisRoom |
260 rm <- thisRoom |
261 chans <- roomOthersChans |
261 chans <- roomOthersChans |
262 |
262 |
|
263 let (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd (teamIndexes cl) msg |
|
264 |
263 if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then |
265 if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then |
264 return $ AnswerClients chans ["EM", legalMsgs] |
266 return $ AnswerClients chans ["EM", legalMsgs] |
265 : [ModifyRoom (\r -> r{gameInfo = liftM |
267 : [ModifyRoom (\r -> r{gameInfo = liftM |
266 (\g -> g{ |
268 (\g -> g{ |
267 roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g |
269 roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g |
268 , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg}) |
270 , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg}) |
269 $ gameInfo r}), RegisterEvent EngineMessage] |
271 $ gameInfo r}), RegisterEvent EngineMessage] |
270 else |
272 else |
271 return [] |
273 return [] |
272 where |
|
273 (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg |
|
274 |
274 |
275 |
275 |
276 handleCmd_inRoom ["ROUNDFINISHED", _] = do |
276 handleCmd_inRoom ["ROUNDFINISHED", _] = do |
277 cl <- thisClient |
277 cl <- thisClient |
278 rm <- thisRoom |
278 rm <- thisRoom |
490 voted (p == ["FORCE"]) (fromJust b) |
490 voted (p == ["FORCE"]) (fromJust b) |
491 else |
491 else |
492 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "vote: 'yes' or 'no'"]] |
492 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "vote: 'yes' or 'no'"]] |
493 |
493 |
494 |
494 |
495 handleCmd_inRoom ["SAVE", stateName] = serverAdminOnly $ do |
495 handleCmd_inRoom ["SAVE", stateName, location] = serverAdminOnly $ do |
496 return [ModifyRoom $ \r -> r{roomSaves = Map.insert stateName (mapParams r, params r) (roomSaves r)}] |
496 return [ModifyRoom $ \r -> r{roomSaves = Map.insert stateName (location, mapParams r, params r) (roomSaves r)}] |
497 |
497 |
498 handleCmd_inRoom ["DELETE", stateName] = serverAdminOnly $ do |
498 handleCmd_inRoom ["DELETE", stateName] = serverAdminOnly $ do |
499 return [ModifyRoom $ \r -> r{roomSaves = Map.delete stateName (roomSaves r)}] |
499 return [ModifyRoom $ \r -> r{roomSaves = Map.delete stateName (roomSaves r)}] |
500 |
500 |
501 handleCmd_inRoom ["SAVEROOM", fileName] = serverAdminOnly $ do |
501 handleCmd_inRoom ["SAVEROOM", fileName] = serverAdminOnly $ do |