gameServer/ServerState.hs
changeset 3458 11cd56019f00
child 3501 a3159a410e5c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gameServer/ServerState.hs	Mon May 10 17:48:06 2010 +0000
@@ -0,0 +1,32 @@
+module ServerState
+    (
+    module RoomsAndClients,
+    clientRoomA,
+    ServerState(..),
+    clients
+    ) where
+
+import Control.Monad.State
+----------------------
+import RoomsAndClients
+import CoreTypes
+
+data ServerState = ServerState {
+        clientIndex :: Maybe ClientIndex,
+        serverInfo :: ServerInfo,
+        roomsClients :: MRnC
+    }
+
+
+clientRoomA :: StateT ServerState IO RoomIndex
+clientRoomA = do
+    (Just ci) <- gets clientIndex
+    rnc <- gets roomsClients
+    liftIO $ clientRoomM rnc ci
+
+clients :: (ClientInfo -> a) -> StateT ServerState IO a
+clients f = do
+    (Just ci) <- gets clientIndex
+    rnc <- gets roomsClients
+    liftIO $ clientsM rnc f ci
+    
\ No newline at end of file