Handle absence of "SCRIPT" in replay
authorunc0rr
Tue, 12 Nov 2013 15:38:45 +0400
changeset 9690 6a1748b71df2
parent 9687 4054960f837a
child 9693 9e31e3bb4476
Handle absence of "SCRIPT" in replay
gameServer/EngineInteraction.hs
--- a/gameServer/EngineInteraction.hs	Fri Nov 08 23:11:27 2013 -0500
+++ b/gameServer/EngineInteraction.hs	Tue Nov 12 15:38:45 2013 +0400
@@ -12,6 +12,7 @@
 import Data.Word
 import Data.Bits
 import Control.Arrow
+import Data.Maybe
 -------------
 import CoreTypes
 import Utils
@@ -74,7 +75,7 @@
         em = toEngineMsg
         eml = em . B.concat
         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
-        maybeScript = let s = head $ prms Map.! "SCRIPT" in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
+        maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
         maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
         scheme = tail $ prms Map.! "SCHEME"
         mapgen = mParams Map.! "MAPGEN"