gameServer/HWProtoLobbyState.hs
changeset 3260 b44b88908758
parent 2961 3e057dfa601f
child 3277 70d4265871ff
equal deleted inserted replaced
3259:a29ccf4aed82 3260:b44b88908758
     4 import qualified Data.IntMap as IntMap
     4 import qualified Data.IntMap as IntMap
     5 import qualified Data.IntSet as IntSet
     5 import qualified Data.IntSet as IntSet
     6 import qualified Data.Foldable as Foldable
     6 import qualified Data.Foldable as Foldable
     7 import Maybe
     7 import Maybe
     8 import Data.List
     8 import Data.List
       
     9 import Data.Word
     9 --------------------------------------
    10 --------------------------------------
    10 import CoreTypes
    11 import CoreTypes
    11 import Actions
    12 import Actions
    12 import Utils
    13 import Utils
    13 
    14 
    27         sameProtoRooms = filter (\r -> (roomProto r == protocol) && not (isRestrictedJoins r)) roomsList
    28         sameProtoRooms = filter (\r -> (roomProto r == protocol) && not (isRestrictedJoins r)) roomsList
    28         roomsList = IntMap.elems rooms
    29         roomsList = IntMap.elems rooms
    29         protocol = clientProto client
    30         protocol = clientProto client
    30         client = clients IntMap.! clID
    31         client = clients IntMap.! clID
    31         roomInfo room
    32         roomInfo room
    32             | clientProto client < 28 = [
    33             | clientProto client < 30 = [
    33                 name room,
    34                 name room,
    34                 show (playersIn room) ++ "(" ++ show (length $ teams room) ++ ")",
    35                 show (playersIn room) ++ "(" ++ show (length $ teams room) ++ ")",
    35                 show $ gameinprogress room
    36                 show $ gameinprogress room
    36                 ]
    37                 ]
    37             | otherwise = [
    38             | otherwise = [
   150         BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick]
   151         BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick]
   151     where
   152     where
   152         client = clients IntMap.! clID
   153         client = clients IntMap.! clID
   153 
   154 
   154 
   155 
   155 handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", newMessage] =
   156 handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", "NEW", newMessage] =
   156         [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator client]
   157         [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator client]
   157     where
   158     where
   158         client = clients IntMap.! clID
   159         client = clients IntMap.! clID
   159 
   160 
       
   161 handleCmd_lobby clID clients rooms ["SET_SERVER_MESSAGE", "OLD", newMessage] =
       
   162         [ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator client]
       
   163     where
       
   164         client = clients IntMap.! clID
       
   165 
       
   166 handleCmd_lobby clID clients rooms ["SET_RELEASE_PROTOCOL_NUMBER", protoNum] =
       
   167     [ModifyServerInfo (\si -> si{latestReleaseVersion = fromJust readNum}) | isAdministrator client && isJust readNum]
       
   168     where
       
   169         client = clients IntMap.! clID
       
   170         readNum = maybeRead protoNum :: Maybe Word16
   160 
   171 
   161 handleCmd_lobby clID clients rooms ["CLEAR_ACCOUNTS_CACHE"] =
   172 handleCmd_lobby clID clients rooms ["CLEAR_ACCOUNTS_CACHE"] =
   162         [ClearAccountsCache | isAdministrator client]
   173         [ClearAccountsCache | isAdministrator client]
   163     where
   174     where
   164         client = clients IntMap.! clID
   175         client = clients IntMap.! clID