equal
deleted
inserted
replaced
4 clientRoomA, |
4 clientRoomA, |
5 ServerState(..), |
5 ServerState(..), |
6 client's, |
6 client's, |
7 allClientsS, |
7 allClientsS, |
8 roomClientsS, |
8 roomClientsS, |
|
9 sameProtoClientsS, |
9 io |
10 io |
10 ) where |
11 ) where |
11 |
12 |
12 import Control.Monad.State.Strict |
13 import Control.Monad.State.Strict |
13 import Data.Set as Set |
14 import Data.Set as Set(Set) |
|
15 import Data.Word |
14 ---------------------- |
16 ---------------------- |
15 import RoomsAndClients |
17 import RoomsAndClients |
16 import CoreTypes |
18 import CoreTypes |
17 |
19 |
18 data ServerState = ServerState { |
20 data ServerState = ServerState { |
41 roomClientsS :: RoomIndex -> StateT ServerState IO [ClientInfo] |
43 roomClientsS :: RoomIndex -> StateT ServerState IO [ClientInfo] |
42 roomClientsS ri = do |
44 roomClientsS ri = do |
43 rnc <- gets roomsClients |
45 rnc <- gets roomsClients |
44 io $ roomClientsM rnc ri |
46 io $ roomClientsM rnc ri |
45 |
47 |
|
48 sameProtoClientsS :: Word16 -> StateT ServerState IO [ClientInfo] |
|
49 sameProtoClientsS p = liftM f allClientsS |
|
50 where |
|
51 f = filter (\c -> clientProto c == p) |
|
52 |
46 io :: IO a -> StateT ServerState IO a |
53 io :: IO a -> StateT ServerState IO a |
47 io = liftIO |
54 io = liftIO |