gameServer/hedgewars-server.hs
changeset 1964 dc9ea05c9d2f
parent 1927 e2031906a347
child 1985 0792e1485d07
equal deleted inserted replaced
1963:58c29439225d 1964:dc9ea05c9d2f
    11 -----------------------------------
    11 -----------------------------------
    12 import Opts
    12 import Opts
    13 import CoreTypes
    13 import CoreTypes
    14 import OfficialServer.DBInteraction
    14 import OfficialServer.DBInteraction
    15 import ServerCore
    15 import ServerCore
       
    16 import Utils
    16 
    17 
    17 
    18 
    18 #if !defined(mingw32_HOST_OS)
    19 #if !defined(mingw32_HOST_OS)
    19 import System.Posix
    20 import System.Posix
    20 #endif
    21 #endif
    32 	setupLoggers
    33 	setupLoggers
    33 
    34 
    34 	stats <- atomically $ newTMVar (StatisticsInfo 0 0)
    35 	stats <- atomically $ newTMVar (StatisticsInfo 0 0)
    35 	dbQueriesChan <- newChan
    36 	dbQueriesChan <- newChan
    36 	coreChan <- newChan
    37 	coreChan <- newChan
    37 	serverInfo <- getOpts $ newServerInfo stats coreChan dbQueriesChan
    38 	serverInfo' <- getOpts $ newServerInfo stats coreChan dbQueriesChan
    38 	
    39 	
       
    40 #if defined(OFFICIAL_SERVER)
       
    41 	dbHost' <- askFromConsole "DB host: "
       
    42 	dbLogin' <- askFromConsole "login: "
       
    43 	dbPassword' <- askFromConsole "password: "
       
    44 	let serverInfo = serverInfo'{dbHost = dbHost', dbLogin = dbLogin', dbPassword = dbPassword'}
       
    45 #else
       
    46 	let serverInfo = serverInfo'
       
    47 #endif
       
    48 
    39 	bracket
    49 	bracket
    40 		(Network.listenOn $ Network.PortNumber $ listenPort serverInfo)
    50 		(Network.listenOn $ Network.PortNumber $ listenPort serverInfo)
    41 		(sClose)
    51 		(sClose)
    42 		(startServer serverInfo)
    52 		(startServer serverInfo)