gameServer/Actions.hs
changeset 9035 e84d42a4311c
parent 9032 2345f5f96a29
child 9060 1661c5ccb625
equal deleted inserted replaced
9034:279168729cc3 9035:e84d42a4311c
    18 import Data.Unique
    18 import Data.Unique
    19 import Control.Arrow
    19 import Control.Arrow
    20 import Control.Exception
    20 import Control.Exception
    21 import System.Process
    21 import System.Process
    22 import Network.Socket
    22 import Network.Socket
       
    23 import System.Random
    23 -----------------------------
    24 -----------------------------
    24 #if defined(OFFICIAL_SERVER)
    25 #if defined(OFFICIAL_SERVER)
    25 import OfficialServer.GameReplayStore
    26 import OfficialServer.GameReplayStore
    26 #endif
    27 #endif
    27 import CoreTypes
    28 import CoreTypes
   613                     , "</td></tr>"])
   614                     , "</td></tr>"])
   614             . Set.toList $ keys
   615             . Set.toList $ keys
   615     processAction $ Warning versionsStats
   616     processAction $ Warning versionsStats
   616 
   617 
   617 
   618 
       
   619 processAction (Random chans items) = do
       
   620     let i = if null items then ["heads", "tails"] else items
       
   621     n <- io $ randomRIO (0, length i - 1)
       
   622     processAction $ AnswerClients chans ["CHAT", "[random]", i !! n]
       
   623 
       
   624 
   618 #if defined(OFFICIAL_SERVER)
   625 #if defined(OFFICIAL_SERVER)
   619 processAction SaveReplay = do
   626 processAction SaveReplay = do
   620     ri <- clientRoomA
   627     ri <- clientRoomA
   621     rnc <- gets roomsClients
   628     rnc <- gets roomsClients
   622 
   629