# HG changeset patch # User unc0rr # Date 1377717065 -14400 # Node ID f0a8ac1918392ff1b194c4814902f8570d4278ac # Parent 0f5961910e2712582b162abd08ae3eed330cc978 Push demo to idle checker on game finish diff -r 0f5961910e27 -r f0a8ac191839 gameServer/Actions.hs --- a/gameServer/Actions.hs Tue Aug 27 17:22:07 2013 +0400 +++ b/gameServer/Actions.hs Wed Aug 28 23:11:05 2013 +0400 @@ -651,9 +651,17 @@ ri <- clientRoomA rnc <- gets roomsClients - io $ do + allci <- io $ do r <- room'sM rnc id ri saveReplay r + allClientsM rnc + + readyCheckersIds <- liftM (filter (client'sM isReadyChecker rnc)) allClientsS + when (not $ null readyCheckersIds) $ do + modify (\s -> s{clientIndex = Just $ head readyCheckersIds}) + processAction CheckRecord + where + isReadyChecker cl = isChecker cl && isReady cl processAction CheckRecord = do @@ -666,10 +674,12 @@ , ModifyClient $ \c -> c{checkInfo = cinfo} ] + processAction (CheckFailed msg) = do Just (CheckInfo fileName _) <- client's checkInfo io $ moveFailedRecord fileName + processAction (CheckSuccess info) = do Just (CheckInfo fileName teams) <- client's checkInfo si <- gets serverInfo diff -r 0f5961910e27 -r f0a8ac191839 gameServer/HWProtoChecker.hs --- a/gameServer/HWProtoChecker.hs Tue Aug 27 17:22:07 2013 +0400 +++ b/gameServer/HWProtoChecker.hs Wed Aug 28 23:11:05 2013 +0400 @@ -11,14 +11,14 @@ handleCmd_checker :: CmdHandler -handleCmd_checker ["READY"] = return [CheckRecord] +handleCmd_checker ["READY"] = return [ModifyClient $ \c -> c{isReady = True}, CheckRecord] handleCmd_checker ["CHECKED", "FAIL", msg] = do isChecking <- liftM (isJust . checkInfo) thisClient if not isChecking then return [] else - return [CheckFailed msg, ModifyClient $ \c -> c{checkInfo = Nothing}] + return [CheckFailed msg, ModifyClient $ \c -> c{isReady = False, checkInfo = Nothing}] handleCmd_checker ("CHECKED" : "OK" : info) = do @@ -26,6 +26,6 @@ if not isChecking then return [] else - return [CheckSuccess info, ModifyClient $ \c -> c{checkInfo = Nothing}] + return [CheckSuccess info, ModifyClient $ \c -> c{isReady = False, checkInfo = Nothing}] handleCmd_checker _ = return [ProtocolError "Unknown command"] diff -r 0f5961910e27 -r f0a8ac191839 gameServer/HandlerUtils.hs --- a/gameServer/HandlerUtils.hs Tue Aug 27 17:22:07 2013 +0400 +++ b/gameServer/HandlerUtils.hs Wed Aug 28 23:11:05 2013 +0400 @@ -64,5 +64,5 @@ clientByNick n = do (_, rnc) <- ask let allClientIDs = allClients rnc - return $ find (\clId -> n == nick (client rnc clId)) allClientIDs + return $ find (\clId -> let cl = client rnc clId in n == nick cl && not (isChecker cl)) allClientIDs