Allow to set motd for old client versions (not used yet, as server needs some refactoring)
--- 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 @@
"<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>"
"<font color=yellow><h3>Hedgewars 0.9.12 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>"
46631
+ 30
0
""
""
--- 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]