Server:
* Added support for flags (this still needs further adjustments to restore compatibility with older versions (team datasets)!)
Engine:
* Added support for flags
* Added weapon tooltips
* Moved SplitBySpace to uMisc
* Set file operations to readonly to avoid conflicts running multiple copies networked and synced on one (fast) machine
* Flash active team while green arrow is shown (waiting for input or camera centered on active hog)
* Updated English locale
Frontend:
* Added support for flags
* Added flag selection to edit team page
* Added checkbox for weapon tooltips in options
* "Random team" button may now be translated
* Disabled "official server" button till protocol is handled for all versions (see above; nemo's server is updated to new protocol)
Graphics:
* Added basic set of example flags
{-# LANGUAGE ScopedTypeVariables #-}
module NetRoutines where
import Network
import Network.Socket
import System.IO
import Control.Concurrent
import Control.Concurrent.Chan
import Control.Concurrent.STM
import qualified Control.Exception as Exception
import Data.Time
-----------------------------
import CoreTypes
import ClientIO
import Utils
acceptLoop :: Socket -> Chan CoreMessage -> Int -> IO ()
acceptLoop servSock coreChan clientCounter = do
Exception.handle
(\(_ :: Exception.IOException) -> putStrLn "exception on connect") $
do
(socket, sockAddr) <- Network.Socket.accept servSock
cHandle <- socketToHandle socket ReadWriteMode
hSetBuffering cHandle LineBuffering
clientHost <- sockAddr2String sockAddr
currentTime <- getCurrentTime
sendChan <- newChan
let newClient =
(ClientInfo
nextID
sendChan
cHandle
clientHost
currentTime
""
""
False
0
0
0
False
False
False
undefined
undefined
)
writeChan coreChan $ Accept newClient
forkIO $ clientRecvLoop cHandle coreChan nextID
forkIO $ clientSendLoop cHandle coreChan sendChan nextID
return ()
acceptLoop servSock coreChan nextID
where
nextID = clientCounter + 1