roguestar-engine 0.2.1 → 0.2.2
raw patch · 3 files changed
+13/−9 lines, 3 filesnew-uploader
Files
- roguestar-engine.cabal +3/−3
- src/Main.hs +2/−1
- src/Protocol.hs +8/−5
roguestar-engine.cabal view
@@ -1,8 +1,8 @@ name: roguestar-engine-version: 0.2.1+version: 0.2.2 license: OtherLicense license-file: LICENSE-author: Christopher Lane Hinson+author: Christopher Lane Hinson <lane@downstairspeople.org> maintainer: Christopher Lane Hinson <lane@downstairspeople.org> category: Game@@ -16,7 +16,7 @@ the game stranded on an alien planet, fighting off an endless hoard of hostile robots. .- The Darcs repository is available at <http://www.downstairspeople.org/darcs/roguestar-engine>.+ The git repository is available at <http://www.downstairspeople.org/git/roguestar-engine.git>. homepage: http://roguestar.downstairspeople.org/ build-depends: base>3, containers, array, old-time, random, mtl, MaybeT
src/Main.hs view
@@ -5,6 +5,7 @@ import DB import System.Environment import System.Random+import System.IO import Data.List import Tests import HierarchicalDatabase@@ -15,7 +16,7 @@ import GridRayCaster roguestar_version_number :: String-roguestar_version_number = "0.2.1"+roguestar_version_number = "0.2.2" roguestar_program_name :: String roguestar_program_name = "roguestar-engine"
src/Protocol.hs view
@@ -26,17 +26,20 @@ import Control.Monad.Error import Numeric import Turns+import Data.IORef -- Don't call dbBehave, use dbPerformPlayerTurn import Behavior hiding (dbBehave) -- We need to construct References based on UIDs, so we cheat a little: import DBPrivate (Reference(..)) mainLoop :: DB_BaseType -> IO ()-mainLoop db0 = do next_command <- getLine- db1 <- ioDispatch (words $ map toLower next_command) db0- putStrLn "over"- hFlush stdout- mainLoop db1+mainLoop db0 = + do db <- newIORef db0+ forever $+ do next_command <- getLine+ writeIORef db =<< ioDispatch (words $ map toLower next_command) =<< readIORef db+ putStrLn "over"+ hFlush stdout done :: DB String done = return "done"