- Add SCHEME which is needed in room config
authorunc0rr
Fri, 24 Jan 2014 09:48:46 +0400
changeset 10066 1a6e1aad58d6
parent 10065 35bd559c1973
child 10067 8df84ec62600
- Add SCHEME which is needed in room config - Fix replay of games on maze maps
gameServer/CoreTypes.hs
gameServer/EngineInteraction.hs
--- a/gameServer/CoreTypes.hs	Fri Jan 24 00:05:19 2014 +0400
+++ b/gameServer/CoreTypes.hs	Fri Jan 24 09:48:46 2014 +0400
@@ -214,8 +214,8 @@
         )
         (
             Map.fromList $ Prelude.zip
-                ["SCRIPT", "THEME", "MAZE_SIZE", "DRAWNMAP"]
-                [["Normal"], ["Theme"], ["0"], ["-"]]
+                ["AMMO", "SCHEME", "SCRIPT", "THEME"]
+                [["Default"], ["Default"], ["Normal"], ["avematan"]]
         )
 
 
--- a/gameServer/EngineInteraction.hs	Fri Jan 24 00:05:19 2014 +0400
+++ b/gameServer/EngineInteraction.hs	Fri Jan 24 09:48:46 2014 +0400
@@ -94,7 +94,7 @@
     where
         keys1, keys2 :: Set.Set B.ByteString
         keys1 = Set.fromList ["MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE"]
-        keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME", "MAZE_SIZE", "DRAWNMAP"]
+        keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME"]
         sane = Set.null (Map.keysSet mParams Set.\\ keys1)
             && Set.null (Map.keysSet prms Set.\\ keys2)
             && (not . null . drop 27 $ scheme)
@@ -105,8 +105,8 @@
         scheme = tail $ prms Map.! "SCHEME"
         mapgen = mParams Map.! "MAPGEN"
         mapgenSpecific = case mapgen of
-            "1" -> [eml ["e$maze_size ", head $ prms Map.! "MAZE_SIZE"]]
-            "2" -> let d = head $ prms Map.! "DRAWNMAP" in if BW.length d <= 1 then [] else drawnMapData d
+            "1" -> [eml ["e$maze_size ", mParams Map.! "MAZE_SIZE"]]
+            "2" -> let d = head . fromMaybe [""] $ Map.lookup "DRAWNMAP" prms in if BW.length d <= 4 then [] else drawnMapData d
             _ -> []
         gameFlags :: Word32
         gameFlags = foldl (\r (b, f) -> if b == "false" then r else r .|. f) 0 $ zip scheme gameFlagConsts