gameServer/CoreTypes.hs
changeset 4975 31da8979e5b1
parent 4960 3b54b1c9b768
child 4982 3572eaf14340
equal deleted inserted replaced
4974:078cd026a7b1 4975:31da8979e5b1
    10 import Data.Function
    10 import Data.Function
    11 import Data.ByteString.Char8 as B
    11 import Data.ByteString.Char8 as B
    12 import Data.Unique
    12 import Data.Unique
    13 import Control.Exception
    13 import Control.Exception
    14 import Data.Typeable
    14 import Data.Typeable
       
    15 import Data.TConfig
    15 -----------------------
    16 -----------------------
    16 import RoomsAndClients
    17 import RoomsAndClients
    17 
    18 
    18 type ClientChan = Chan [B.ByteString]
    19 type ClientChan = Chan [B.ByteString]
    19 
    20 
   121     {
   122     {
   122         playersNumber :: Int,
   123         playersNumber :: Int,
   123         roomsNumber :: Int
   124         roomsNumber :: Int
   124     }
   125     }
   125 
   126 
   126 data ServerInfo =
   127 data ServerInfo c =
   127     ServerInfo
   128     ServerInfo
   128     {
   129     {
   129         isDedicated :: Bool,
   130         isDedicated :: Bool,
   130         serverMessage :: B.ByteString,
   131         serverMessage :: B.ByteString,
   131         serverMessageForOldVersions :: B.ByteString,
   132         serverMessageForOldVersions :: B.ByteString,
   136         dbLogin :: B.ByteString,
   137         dbLogin :: B.ByteString,
   137         dbPassword :: B.ByteString,
   138         dbPassword :: B.ByteString,
   138         lastLogins :: [(B.ByteString, (UTCTime, B.ByteString))],
   139         lastLogins :: [(B.ByteString, (UTCTime, B.ByteString))],
   139         restartPending :: Bool,
   140         restartPending :: Bool,
   140         coreChan :: Chan CoreMessage,
   141         coreChan :: Chan CoreMessage,
   141         dbQueries :: Chan DBQuery
   142         dbQueries :: Chan DBQuery,
   142     }
   143         serverConfig :: Maybe c
   143 
   144     }
   144 instance Show ServerInfo where
   145 
       
   146 instance Show (ServerInfo c) where
   145     show _ = "Server Info"
   147     show _ = "Server Info"
   146 
   148 
   147 newServerInfo :: Chan CoreMessage -> Chan DBQuery -> ServerInfo
   149 newServerInfo :: Chan CoreMessage -> Chan DBQuery -> Maybe c -> ServerInfo c
   148 newServerInfo =
   150 newServerInfo =
   149     ServerInfo
   151     ServerInfo
   150         True
   152         True
   151         "<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   153         "<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   152         "<font color=yellow><h3 align=center>Hedgewars 0.9.14.1 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>"
   154         "<font color=yellow><h3 align=center>Hedgewars 0.9.14.1 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>"