gameServer/Actions.hs
changeset 9035 e84d42a4311c
parent 9032 2345f5f96a29
child 9060 1661c5ccb625
--- a/gameServer/Actions.hs	Wed May 22 00:12:15 2013 +0400
+++ b/gameServer/Actions.hs	Wed May 22 00:49:37 2013 +0400
@@ -20,6 +20,7 @@
 import Control.Exception
 import System.Process
 import Network.Socket
+import System.Random
 -----------------------------
 #if defined(OFFICIAL_SERVER)
 import OfficialServer.GameReplayStore
@@ -615,6 +616,12 @@
     processAction $ Warning versionsStats
 
 
+processAction (Random chans items) = do
+    let i = if null items then ["heads", "tails"] else items
+    n <- io $ randomRIO (0, length i - 1)
+    processAction $ AnswerClients chans ["CHAT", "[random]", i !! n]
+
+
 #if defined(OFFICIAL_SERVER)
 processAction SaveReplay = do
     ri <- clientRoomA