equal
deleted
inserted
replaced
15 import Actions |
15 import Actions |
16 import OfficialServer.DBInteraction |
16 import OfficialServer.DBInteraction |
17 |
17 |
18 |
18 |
19 timerLoop :: Int -> Chan CoreMessage -> IO() |
19 timerLoop :: Int -> Chan CoreMessage -> IO() |
20 timerLoop tick messagesChan = do |
20 timerLoop tick messagesChan = threadDelay (30 * 10^6) >> (writeChan messagesChan $ TimerAction tick) >> timerLoop (tick + 1) messagesChan |
21 threadDelay (30 * 10^6) -- 30 seconds |
|
22 writeChan messagesChan $ TimerAction tick |
|
23 timerLoop (tick + 1) messagesChan |
|
24 |
21 |
25 firstAway (_, a, b, c) = (a, b, c) |
22 firstAway (_, a, b, c) = (a, b, c) |
26 |
23 |
27 reactCmd :: ServerInfo -> Int -> [String] -> Clients -> Rooms -> IO (ServerInfo, Clients, Rooms) |
24 reactCmd :: ServerInfo -> Int -> [String] -> Clients -> Rooms -> IO (ServerInfo, Clients, Rooms) |
28 reactCmd serverInfo clID cmd clients rooms = |
25 reactCmd serverInfo clID cmd clients rooms = |
83 |
80 |
84 forkIO $ timerLoop 0 $ coreChan serverInfo |
81 forkIO $ timerLoop 0 $ coreChan serverInfo |
85 |
82 |
86 startDBConnection $ serverInfo |
83 startDBConnection $ serverInfo |
87 |
84 |
88 mainLoop serverInfo IntMap.empty (IntMap.singleton 0 newRoom) |
85 forkIO $ mainLoop serverInfo IntMap.empty (IntMap.singleton 0 newRoom) |
|
86 |
|
87 forever $ threadDelay (60 * 60 * 10^6) >> putStrLn "***" |