# HG changeset patch # User unc0rr # Date 1270223963 0 # Node ID b44b88908758cc2bb21b6ae5a34325047acad0e8 # Parent a29ccf4aed82393cd4153283e4bffe65882f5bd1 Allow to set motd for old client versions (not used yet, as server needs some refactoring) diff -r a29ccf4aed82 -r b44b88908758 gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Fri Apr 02 15:58:45 2010 +0000 +++ b/gameServer/CoreTypes.hs Fri Apr 02 15:59:23 2010 +0000 @@ -130,6 +130,7 @@ isDedicated :: Bool, serverMessage :: String, serverMessageForOldVersions :: String, + latestReleaseVersion :: Word16, listenPort :: PortNumber, nextRoomID :: Int, dbHost :: String, @@ -150,6 +151,7 @@ "

http://www.hedgewars.org/

" "

Hedgewars 0.9.12 is out! Please update.

Download page here" 46631 + 30 0 "" "" diff -r a29ccf4aed82 -r b44b88908758 gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Fri Apr 02 15:58:45 2010 +0000 +++ b/gameServer/HWProtoLobbyState.hs Fri Apr 02 15:59:23 2010 +0000 @@ -6,6 +6,7 @@ import qualified Data.Foldable as Foldable import Maybe import Data.List +import Data.Word -------------------------------------- import CoreTypes import Actions @@ -29,7 +30,7 @@ protocol = clientProto client client = clients IntMap.! clID roomInfo room - | clientProto client < 28 = [ + | clientProto client < 30 = [ name room, show (playersIn room) ++ "(" ++ show (length $ teams room) ++ ")", show $ gameinprogress room @@ -152,11 +153,21 @@ client = clients IntMap.! clID -handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", newMessage] = +handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", "NEW", newMessage] = [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator client] where client = clients IntMap.! clID +handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", "OLD", newMessage] = + [ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator client] + where + client = clients IntMap.! clID + +handleCmd_lobby clID clients rooms ["SET_RELEASE_PROTOCOL_NUMBER", protoNum] = + [ModifyServerInfo (\si -> si{latestReleaseVersion = fromJust readNum}) | isAdministrator client && isJust readNum] + where + client = clients IntMap.! clID + readNum = maybeRead protoNum :: Maybe Word16 handleCmd_lobby clID clients rooms ["CLEAR_ACCOUNTS_CACHE"] = [ClearAccountsCache | isAdministrator client]