gameServer/CoreTypes.hs
branchwebgl
changeset 9950 2759212a27de
parent 9884 6e09ca662fa3
child 9973 7589978c9912
equal deleted inserted replaced
9521:8054d9d775fd 9950:2759212a27de
    99         nick :: B.ByteString,
    99         nick :: B.ByteString,
   100         webPassword :: B.ByteString,
   100         webPassword :: B.ByteString,
   101         logonPassed :: Bool,
   101         logonPassed :: Bool,
   102         isVisible :: Bool,
   102         isVisible :: Bool,
   103         clientProto :: !Word16,
   103         clientProto :: !Word16,
   104         roomID :: RoomIndex,
       
   105         pingsQueue :: !Word,
   104         pingsQueue :: !Word,
   106         isMaster :: Bool,
   105         isMaster :: Bool,
   107         isReady :: !Bool,
   106         isReady :: !Bool,
   108         isInGame :: Bool,
   107         isInGame :: Bool,
   109         isAdministrator :: Bool,
   108         isAdministrator :: Bool,
   169         []
   168         []
   170 
   169 
   171 data RoomInfo =
   170 data RoomInfo =
   172     RoomInfo
   171     RoomInfo
   173     {
   172     {
   174         masterID :: ClientIndex,
   173         masterID :: Maybe ClientIndex,
   175         name :: B.ByteString,
   174         name :: B.ByteString,
   176         password :: B.ByteString,
   175         password :: B.ByteString,
   177         roomProto :: Word16,
   176         roomProto :: Word16,
   178         teams :: [TeamInfo],
   177         teams :: [TeamInfo],
   179         gameInfo :: Maybe GameInfo,
   178         gameInfo :: Maybe GameInfo,
   180         playersIn :: !Int,
   179         playersIn :: !Int,
   181         readyPlayers :: !Int,
   180         readyPlayers :: !Int,
   182         isRestrictedJoins :: Bool,
   181         isRestrictedJoins :: Bool,
   183         isRestrictedTeams :: Bool,
   182         isRestrictedTeams :: Bool,
   184         isRegisteredOnly :: Bool,
   183         isRegisteredOnly :: Bool,
       
   184         isSpecial :: Bool,
       
   185         greeting :: B.ByteString,
   185         roomBansList :: ![B.ByteString],
   186         roomBansList :: ![B.ByteString],
   186         mapParams :: Map.Map B.ByteString B.ByteString,
   187         mapParams :: Map.Map B.ByteString B.ByteString,
   187         params :: Map.Map B.ByteString [B.ByteString]
   188         params :: Map.Map B.ByteString [B.ByteString]
   188     }
   189     }
   189 
   190 
   190 newRoom :: RoomInfo
   191 newRoom :: RoomInfo
   191 newRoom =
   192 newRoom =
   192     RoomInfo
   193     RoomInfo
   193         (error "No room master defined")
   194         Nothing
   194         ""
   195         ""
   195         ""
   196         ""
   196         0
   197         0
   197         []
   198         []
   198         Nothing
   199         Nothing
   199         0
   200         0
   200         0
   201         0
   201         False
   202         False
   202         False
   203         False
   203         False
   204         False
       
   205         False
       
   206         ""
   204         []
   207         []
   205         (
   208         (
   206             Map.fromList $ Prelude.zipWith (,)
   209             Map.fromList $ Prelude.zip
   207                 ["MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE"]
   210                 ["MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE"]
   208                 ["+rnd+", "0", "0", "seed", "0"]
   211                 ["+rnd+", "0", "0", "seed", "0"]
   209         )
   212         )
   210         (Map.singleton "SCHEME" ["Default"])
   213         (
       
   214             Map.fromList $ Prelude.zip
       
   215                 ["SCHEME", "SCRIPT"]
       
   216                 [["Default"], ["Normal"]]
       
   217         )
       
   218 
   211 
   219 
   212 data StatisticsInfo =
   220 data StatisticsInfo =
   213     StatisticsInfo
   221     StatisticsInfo
   214     {
   222     {
   215         playersNumber :: Int,
   223         playersNumber :: Int,
   243 newServerInfo =
   251 newServerInfo =
   244     ServerInfo
   252     ServerInfo
   245         True
   253         True
   246         "<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   254         "<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   247         "<font color=yellow><h3 align=center>Hedgewars 0.9.19 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>"
   255         "<font color=yellow><h3 align=center>Hedgewars 0.9.19 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>"
   248         45 -- latestReleaseVersion
   256         47 -- latestReleaseVersion
   249         41 -- earliestCompatibleVersion
   257         41 -- earliestCompatibleVersion
   250         46631
   258         46631
   251         ""
   259         ""
   252         ""
   260         ""
   253         ""
   261         ""
   265 
   273 
   266 data DBQuery =
   274 data DBQuery =
   267     CheckAccount ClientIndex Int B.ByteString B.ByteString
   275     CheckAccount ClientIndex Int B.ByteString B.ByteString
   268     | ClearCache
   276     | ClearCache
   269     | SendStats Int Int
   277     | SendStats Int Int
   270     | StoreAchievements B.ByteString [(B.ByteString, B.ByteString)] [B.ByteString]
   278     | StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] [B.ByteString]
   271     | GetReplayName ClientIndex Int B.ByteString
   279     | GetReplayName ClientIndex Int B.ByteString
   272     deriving (Show, Read)
   280     deriving (Show, Read)
   273 
   281 
   274 data CoreMessage =
   282 data CoreMessage =
   275     Accept ClientInfo
   283     Accept ClientInfo