gameServer/Actions.hs
changeset 10212 5fb3bb2de9d2
parent 10195 d1c23bb73346
child 10215 26fc5502ba22
--- a/gameServer/Actions.hs	Thu Mar 20 22:14:30 2014 +0400
+++ b/gameServer/Actions.hs	Sun Mar 23 23:35:33 2014 +0400
@@ -34,9 +34,7 @@
 import ConfigFile
 import EngineInteraction
 import FloodDetection
-
-
-type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
+import HWProtoCore
 
 
 othersChans :: StateT ServerState IO [ClientChan]
@@ -798,3 +796,10 @@
 processAction (RegisterEvent e) = do
     actions <- registerEvent e
     mapM_ processAction actions
+
+
+processAction (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