GameInfo needs room params copy
authorunc0rr
Thu, 29 Sep 2011 17:25:25 +0400
changeset 6069 d59745e525ec
parent 6068 e18713ecf1e0
child 6070 429b4637c8ad
GameInfo needs room params copy
gameServer/CoreTypes.hs
gameServer/EngineInteraction.hs
gameServer/HWProtoInRoomState.hs
--- a/gameServer/CoreTypes.hs	Tue Sep 27 19:27:19 2011 +0400
+++ b/gameServer/CoreTypes.hs	Thu Sep 29 17:25:25 2011 +0400
@@ -69,10 +69,12 @@
         roundMsgs :: Seq B.ByteString,
         leftTeams :: [B.ByteString],
         teamsAtStart :: [TeamInfo],
-        allPlayersHaveRegisteredAccounts :: Bool
-    }
+        allPlayersHaveRegisteredAccounts :: Bool,
+        giMapParams :: Map.Map B.ByteString B.ByteString,
+        giParams :: Map.Map B.ByteString [B.ByteString]
+    } deriving (Show, Read)
     
-newGameInfo :: Bool -> GameInfo 
+--newGameInfo ::  -> GameInfo 
 newGameInfo = 
     GameInfo
         Data.Sequence.empty
--- a/gameServer/EngineInteraction.hs	Tue Sep 27 19:27:19 2011 +0400
+++ b/gameServer/EngineInteraction.hs	Thu Sep 29 17:25:25 2011 +0400
@@ -6,7 +6,8 @@
 import qualified Codec.Binary.Base64 as Base64
 import qualified Data.ByteString.Char8 as B
 import qualified Data.ByteString as BW
-
+-------------
+import CoreTypes
 
 
 toEngineMsg :: B.ByteString -> B.ByteString
@@ -30,3 +31,9 @@
         legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages
         slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
 
+gameInfo2Replay :: GameInfo -> B.ByteString
+gameInfo2Replay GameInfo{roundMsgs = rm,
+        teamsAtStart = teams,
+        params1 = giMapParams,
+        params2 = giParams} = do
+            
--- a/gameServer/HWProtoInRoomState.hs	Tue Sep 27 19:27:19 2011 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Thu Sep 29 17:25:25 2011 +0400
@@ -179,7 +179,7 @@
             return [
                 ModifyRoom
                     (\r -> r{
-                        gameInfo = Just $ newGameInfo allPlayersRegistered
+                        gameInfo = Just $ newGameInfo allPlayersRegistered (mapParams rm) (params rm)
                         }
                     ),
                 AnswerClients chans ["RUN_GAME"]