Permalink
Browse files

make some parameters configurable, as requested in TODOs

  • Loading branch information...
1 parent a9cc93d commit 59e15778e2d3f408f366169a09c9225c55d97d23 @Mikolaj Mikolaj committed Mar 2, 2011
Showing with 12 additions and 7 deletions.
  1. +3 −2 src/Actions.hs
  2. +6 −0 src/LambdaHack.config.default
  3. +0 −4 src/Monster.hs
  4. +3 −1 src/Turn.hs
View
@@ -172,9 +172,10 @@ history :: Action ()
history =
do
msg <- resetMessage
+ config <- gets sconfig
+ let historyMax = Config.get config "ui" "historyMax"
unless (L.null msg) $
- modify (updateHistory (take 500 . ((msg ++ " "):)))
- -- TODO: make history max configurable
+ modify (updateHistory (take historyMax . ((msg ++ " "):)))
-- | Update player memory.
remember :: Action ()
@@ -33,3 +33,9 @@ saveGame: LambdaHack.save
baseHp: 50
extraHeroes: 0
firstDeathEnds: False
+
+[monsters]
+smellTimeout: 1000
+
+[ui]
+historyMax: 500
View
@@ -17,10 +17,6 @@ heroHP config =
k = Config.get config "heroes" "extraHeroes"
in b `div` (k + 1)
--- | Time a hero can be traced by monsters. TODO: Make configurable.
-smellTimeout :: Time
-smellTimeout = 1000
-
-- | Initial hero.
defaultHero :: Int -> Loc -> Int -> Hero
defaultHero n ploc hp =
View
@@ -9,6 +9,7 @@ import Action
import Actions
import Actor
import Command
+import qualified Config
import Display2 hiding (display)
import Keybindings
import qualified Keys as K
@@ -156,7 +157,8 @@ handlePlayer =
advanceTime APlayer -- TODO: the command handlers should advance the move time
state <- get
let time = stime state
- let loc = mloc (splayer state)
+ loc = mloc (splayer state)
+ smellTimeout = Config.get (sconfig state) "monsters" "smellTimeout"
-- update smell
modify (updateLevel (updateSMap (M.insert loc (time + smellTimeout))))
-- determine player perception and continue with monster moves

0 comments on commit 59e1577

Please sign in to comment.