summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopherLaneHinson <>2008-08-17 01:03:27 (GMT)
committerLuite Stegeman <luite@luite.com>2008-08-17 01:03:27 (GMT)
commitcd8e1afe24674f017713047b42c33db70f749b2b (patch)
treec8a186300d465796d7f5e4af6cb756325ad7ba9b
parent490293ed869ba2af7251f8b396602349dca48e41 (diff)
version 0.2.20.2.2
-rwxr-xr-x[-rw-r--r--]Setup.hs0
-rw-r--r--roguestar-engine.cabal6
-rw-r--r--src/Main.hs3
-rw-r--r--src/Protocol.hs13
4 files changed, 13 insertions, 9 deletions
diff --git a/Setup.hs b/Setup.hs
index 64b897b..64b897b 100644..100755
--- a/Setup.hs
+++ b/Setup.hs
diff --git a/roguestar-engine.cabal b/roguestar-engine.cabal
index ff8bba3..8cd4a93 100644
--- a/roguestar-engine.cabal
+++ b/roguestar-engine.cabal
@@ -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 @@ description: Roguestar is a science fiction themed roguelike (turn-based
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
diff --git a/src/Main.hs b/src/Main.hs
index 1ae16cc..575059f 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -5,6 +5,7 @@ module Main (main)
import DB
import System.Environment
import System.Random
+import System.IO
import Data.List
import Tests
import HierarchicalDatabase
@@ -15,7 +16,7 @@ import Protocol
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"
diff --git a/src/Protocol.hs b/src/Protocol.hs
index 7881ba1..18603a5 100644
--- a/src/Protocol.hs
+++ b/src/Protocol.hs
@@ -26,17 +26,20 @@ import ToolData
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"