Pass correct script name for scripts with spaces in name
authorunc0rr
Mon, 09 Nov 2015 20:51:18 +0300
changeset 11337 41ca5f8ace18
parent 11336 14de659a4b79
child 11340 dfcbc2639ade
Pass correct script name for scripts with spaces in name
gameServer/EngineInteraction.hs
--- a/gameServer/EngineInteraction.hs	Mon Nov 09 16:34:32 2015 +0000
+++ b/gameServer/EngineInteraction.hs	Mon Nov 09 20:51:18 2015 +0300
@@ -129,7 +129,7 @@
             && ((B.length . head . tail $ prms Map.! "AMMO") > 200)
         mapGenTypes = ["+rnd+", "+maze+", "+drawn+", "+perlin+"]
         scriptName = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms
-        maybeScript = let s = scriptName in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
+        maybeScript = let s = scriptName in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", spaces2Underlining 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"
@@ -166,6 +166,7 @@
         infRopes = ammoStr `B.index` 7  == '9'
         vamp = gameFlags .&. 0x00000200 /= 0
         infattacks = gameFlags .&. 0x00100000 /= 0
+        spaces2Underlining = B.map (\c -> if c == ' ' then '_' else c)
 
 drawnMapData :: B.ByteString -> [B.ByteString]
 drawnMapData =