gameServer/Actions.hs
changeset 11581 fd02a080d962
parent 11580 c8edd93b970f
child 11854 0b8f2116aa26
equal deleted inserted replaced
11580:c8edd93b970f 11581:fd02a080d962
   730 
   730 
   731 processAction (LoadGhost location) = do
   731 processAction (LoadGhost location) = do
   732     ri <- clientRoomA
   732     ri <- clientRoomA
   733     rnc <- gets roomsClients
   733     rnc <- gets roomsClients
   734     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
   734     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
       
   735 #if defined(OFFICIAL_SERVER)
   735     rm <- io $ room'sM rnc id ri
   736     rm <- io $ room'sM rnc id ri
   736 #if defined(OFFICIAL_SERVER)
       
   737     points <- io $ loadFile (B.unpack $ "ghosts/" `B.append` sanitizeName location)
   737     points <- io $ loadFile (B.unpack $ "ghosts/" `B.append` sanitizeName location)
   738     when (roomProto rm > 51) $ do
   738     when (roomProto rm > 51) $ do
   739         processAction $ ModifyRoom $ \r -> r{params = Map.insert "DRAWNMAP" [prependGhostPoints (toP points) $ head $ (params r) Map.! "DRAWNMAP"] (params r)}
   739         processAction $ ModifyRoom $ \r -> r{params = Map.insert "DRAWNMAP" [prependGhostPoints (toP points) $ head $ (params r) Map.! "DRAWNMAP"] (params r)}
   740 #endif
   740 #endif
   741     cl <- client's id
   741     cl <- client's id
       
   742     rm <- io $ room'sM rnc id ri
   742     mapM_ processAction $ map (replaceChans thisRoomChans) $ answerFullConfigParams cl (mapParams rm) (params rm)
   743     mapM_ processAction $ map (replaceChans thisRoomChans) $ answerFullConfigParams cl (mapParams rm) (params rm)
   743     where
   744     where
   744     loadFile :: String -> IO [Int]
   745     loadFile :: String -> IO [Int]
   745     loadFile fileName = E.handle (\(e :: SomeException) -> return []) $ do
   746     loadFile fileName = E.handle (\(e :: SomeException) -> return []) $ do
   746         points <- liftM read $ readFile fileName
   747         points <- liftM read $ readFile fileName