gameServer/CoreTypes.hs
changeset 2004 f7944d5adc5f
parent 1986 15e612c68ea8
child 2104 b2c50a7480ea
equal deleted inserted replaced
2003:41b3d00949ca 2004:f7944d5adc5f
    13 
    13 
    14 
    14 
    15 data ClientInfo =
    15 data ClientInfo =
    16  ClientInfo
    16  ClientInfo
    17 	{
    17 	{
    18 		clientUID :: Int,
    18 		clientUID :: !Int,
    19 		sendChan :: Chan [String],
    19 		sendChan :: Chan [String],
    20 		clientHandle :: Handle,
    20 		clientHandle :: Handle,
    21 		host :: String,
    21 		host :: String,
    22 		connectTime :: UTCTime,
    22 		connectTime :: UTCTime,
    23 		nick :: String,
    23 		nick :: String,
    24 		webPassword :: String,
    24 		webPassword :: String,
    25 		logonPassed :: Bool,
    25 		logonPassed :: Bool,
    26 		clientProto :: Word16,
    26 		clientProto :: !Word16,
    27 		roomID :: Int,
    27 		roomID :: !Int,
    28 		pingsQueue :: Word,
    28 		pingsQueue :: !Word,
    29 		isMaster :: Bool,
    29 		isMaster :: Bool,
    30 		isReady :: Bool,
    30 		isReady :: Bool,
    31 		isAdministrator :: Bool,
    31 		isAdministrator :: Bool
    32 		forceQuit :: Bool,
       
    33 		partRoom :: Bool
       
    34 	}
    32 	}
    35 
    33 
    36 instance Show ClientInfo where
    34 instance Show ClientInfo where
    37 	show ci = show $ clientUID ci
    35 	show ci = (show $ clientUID ci)
       
    36 			++ " nick: " ++ (nick ci)
       
    37 			++ " host: " ++ (host ci)
    38 
    38 
    39 instance Eq ClientInfo where
    39 instance Eq ClientInfo where
    40 	a1 == a2 = clientHandle a1 == clientHandle a2
    40 	a1 == a2 = clientHandle a1 == clientHandle a2
    41 
    41 
    42 data HedgehogInfo =
    42 data HedgehogInfo =
    57 	}
    57 	}
    58 
    58 
    59 data RoomInfo =
    59 data RoomInfo =
    60 	RoomInfo
    60 	RoomInfo
    61 	{
    61 	{
    62 		roomUID :: Int,
    62 		roomUID :: !Int,
    63 		name :: String,
    63 		name :: String,
    64 		password :: String,
    64 		password :: String,
    65 		roomProto :: Word16,
    65 		roomProto :: Word16,
    66 		teams :: [TeamInfo],
    66 		teams :: [TeamInfo],
    67 		gameinprogress :: Bool,
    67 		gameinprogress :: Bool,
    68 		playersIn :: !Int,
    68 		playersIn :: !Int,
    69 		readyPlayers :: Int,
    69 		readyPlayers :: !Int,
    70 		playersIDs :: IntSet.IntSet,
    70 		playersIDs :: IntSet.IntSet,
    71 		isRestrictedJoins :: Bool,
    71 		isRestrictedJoins :: Bool,
    72 		isRestrictedTeams :: Bool,
    72 		isRestrictedTeams :: Bool,
    73 		roundMsgs :: Seq String,
    73 		roundMsgs :: Seq String,
    74 		leftTeams :: [String],
    74 		leftTeams :: [String],
   116 	{
   116 	{
   117 		isDedicated :: Bool,
   117 		isDedicated :: Bool,
   118 		serverMessage :: String,
   118 		serverMessage :: String,
   119 		serverMessageForOldVersions :: String,
   119 		serverMessageForOldVersions :: String,
   120 		listenPort :: PortNumber,
   120 		listenPort :: PortNumber,
   121 		loginsNumber :: Int,
       
   122 		nextRoomID :: Int,
   121 		nextRoomID :: Int,
   123 		dbHost :: String,
   122 		dbHost :: String,
   124 		dbLogin :: String,
   123 		dbLogin :: String,
   125 		dbPassword :: String,
   124 		dbPassword :: String,
   126 		lastLogins :: [(String, UTCTime)],
   125 		lastLogins :: [(String, UTCTime)],
   128 		coreChan :: Chan CoreMessage,
   127 		coreChan :: Chan CoreMessage,
   129 		dbQueries :: Chan DBQuery
   128 		dbQueries :: Chan DBQuery
   130 	}
   129 	}
   131 
   130 
   132 instance Show ServerInfo where
   131 instance Show ServerInfo where
   133 	show si = "Logins: " ++ (show $ loginsNumber si)
   132 	show si = "Server Info"
   134 
   133 
   135 newServerInfo = (
   134 newServerInfo = (
   136 	ServerInfo
   135 	ServerInfo
   137 		True
   136 		True
   138 		"<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   137 		"<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
   139 		"<font color=yellow><h3>Hedgewars 0.9.10 is out! Please, update. Support for previous versions IS DROPPED</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></p><h4>New features are:</h4><ul><li>Large maps</li><li>New game options</li><li>Utilities</li><li>...</li></ul></font>"
   138 		"<font color=yellow><h3>Hedgewars 0.9.10 is out! Please, update. Support for previous versions IS DROPPED</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></p><h4>New features are:</h4><ul><li>Large maps</li><li>New game options</li><li>Utilities</li><li>...</li></ul></font>"
   140 		46631
   139 		46631
   141 		0
       
   142 		0
   140 		0
   143 		""
   141 		""
   144 		""
   142 		""
   145 		""
   143 		""
   146 		[]
   144 		[]