equal
deleted
inserted
replaced
649 #if defined(OFFICIAL_SERVER) |
649 #if defined(OFFICIAL_SERVER) |
650 processAction SaveReplay = do |
650 processAction SaveReplay = do |
651 ri <- clientRoomA |
651 ri <- clientRoomA |
652 rnc <- gets roomsClients |
652 rnc <- gets roomsClients |
653 |
653 |
654 io $ do |
654 allci <- io $ do |
655 r <- room'sM rnc id ri |
655 r <- room'sM rnc id ri |
656 saveReplay r |
656 saveReplay r |
|
657 allClientsM rnc |
|
658 |
|
659 readyCheckersIds <- liftM (filter (client'sM isReadyChecker rnc)) allClientsS |
|
660 when (not $ null readyCheckersIds) $ do |
|
661 modify (\s -> s{clientIndex = Just $ head readyCheckersIds}) |
|
662 processAction CheckRecord |
|
663 where |
|
664 isReadyChecker cl = isChecker cl && isReady cl |
657 |
665 |
658 |
666 |
659 processAction CheckRecord = do |
667 processAction CheckRecord = do |
660 p <- client's clientProto |
668 p <- client's clientProto |
661 c <- client's sendChan |
669 c <- client's sendChan |
664 mapM_ processAction [ |
672 mapM_ processAction [ |
665 AnswerClients [c] ("REPLAY" : l) |
673 AnswerClients [c] ("REPLAY" : l) |
666 , ModifyClient $ \c -> c{checkInfo = cinfo} |
674 , ModifyClient $ \c -> c{checkInfo = cinfo} |
667 ] |
675 ] |
668 |
676 |
|
677 |
669 processAction (CheckFailed msg) = do |
678 processAction (CheckFailed msg) = do |
670 Just (CheckInfo fileName _) <- client's checkInfo |
679 Just (CheckInfo fileName _) <- client's checkInfo |
671 io $ moveFailedRecord fileName |
680 io $ moveFailedRecord fileName |
|
681 |
672 |
682 |
673 processAction (CheckSuccess info) = do |
683 processAction (CheckSuccess info) = do |
674 Just (CheckInfo fileName teams) <- client's checkInfo |
684 Just (CheckInfo fileName teams) <- client's checkInfo |
675 si <- gets serverInfo |
685 si <- gets serverInfo |
676 io $ writeChan (dbQueries si) $ StoreAchievements (B.pack fileName) (map toPair teams) info |
686 io $ writeChan (dbQueries si) $ StoreAchievements (B.pack fileName) (map toPair teams) info |