gameServer/ServerCore.hs
changeset 10212 5fb3bb2de9d2
parent 10017 de822cd3df3a
child 10215 26fc5502ba22
--- a/gameServer/ServerCore.hs	Thu Mar 20 22:14:30 2014 +0400
+++ b/gameServer/ServerCore.hs	Sun Mar 23 23:35:33 2014 +0400
@@ -6,14 +6,11 @@
 import Control.Monad.Reader
 import Control.Monad.State.Strict
 import Data.Set as Set
-import qualified Data.ByteString.Char8 as B
-import Control.DeepSeq
 import Data.Unique
 import Data.Maybe
 --------------------------------------
 import CoreTypes
 import NetRoutines
-import HWProtoCore
 import Actions
 import OfficialServer.DBInteraction
 import ServerState
@@ -23,13 +20,6 @@
 timerLoop tick messagesChan = threadDelay 30000000 >> writeChan messagesChan (TimerAction tick) >> timerLoop (tick + 1) messagesChan
 
 
-reactCmd :: [B.ByteString] -> StateT ServerState IO ()
-reactCmd cmd = do
-    (Just ci) <- gets clientIndex
-    rnc <- gets roomsClients
-    actions <- liftIO $ withRoomsAndClients rnc (\irnc -> runReader (handleCmd cmd) (ci, irnc))
-    forM_ (actions `deepseq` actions) processAction
-
 mainLoop :: StateT ServerState IO ()
 mainLoop = forever $ do
     -- get >>= \s -> put $! s
@@ -46,7 +36,7 @@
             removed <- gets removedClients
             unless (ci `Set.member` removed) $ do
                 modify (\s -> s{clientIndex = Just ci})
-                reactCmd cmd
+                processAction $ ReactCmd cmd
 
         Remove ci ->
             processAction (DeleteClient ci)