Permalink
Browse files

tweaks and comments, mostly about TODOs for actions

  • Loading branch information...
1 parent 8959e49 commit 7bd9ccfbaebcdbf0ed45df535ada71711559aed6 @Mikolaj Mikolaj committed Jan 26, 2011
Showing with 16 additions and 14 deletions.
  1. +1 −0 LambdaHack.config.example
  2. +8 −11 src/Actions.hs
  3. +2 −2 src/Dungeon.hs
  4. +2 −1 src/LambdaHack.hs
  5. +3 −0 src/Level.hs
@@ -22,4 +22,5 @@ fov_radius: 40
depth: 10
level3: bigroom
level10: noiseroom
+level2: rogueroom # the default for most levels
#level1: noiseroom
View
@@ -54,7 +54,7 @@ quitGame =
do
b <- messageYesNo "Really quit?"
if b
- then end -- TODO: why no highscore?
+ then end -- TODO: why no highscore? because the user may be in a hurry, since he quits the game instead of getting himself killed properly?
else abortWith "Game resumed."
cancelCurrent :: Action ()
@@ -231,14 +231,11 @@ lvldescend :: Loc -> Int -> Action ()
lvldescend loc k =
do
state <- get
- case lname (slevel state) of
- LambdaCave n ->
- let nln = n + k
- -- TODO: 10 hardcoded; perhaps change getDungeonLevel?
- in if nln >= 1 && nln <= 10
- then lvlswitch (LambdaCave nln, loc)
- else abortWith "no more levels in this direction"
- _ -> error "lvlchange"
+ let n = levelNumber (lname (slevel state))
+ nln = n + k
+ if nln >= 1 && nln <= sizeDungeon (sdungeon state)
+ then lvlswitch (LambdaCave nln, loc)
+ else abortWith "no more levels in this direction"
-- | Attempt a level change via up level and down level keys.
-- Will quit the game if the player leaves the dungeon.
@@ -258,7 +255,7 @@ lvlchange vdir =
-- we are at the "end" of the dungeon
fleeDungeon
Just (nln, nloc) ->
- -- TODO: in loook mode, check if the target stairs are known and if not, land in the same location as in the current level so as not to reveal stairs location
+ -- TODO: in look mode, check if the target stairs are known and if not, land in the same location as in the current level so as not to reveal stairs location
lvlswitch (nln, nloc)
_ -> -- no stairs
if isNothing (slook state)
@@ -324,7 +321,7 @@ handleScores write killed victor total =
cfg <- gets sconfig
time <- gets stime
let points = if killed then (total + 1) `div` 2 else total
- let current = levelNumber nm -- TODO: rather use name of level
+ let current = levelNumber nm -- TODO: rather use name of level; but the number too, since it tells about relative difficulty
curDate <- liftIO getClockTime
let score = H.ScoreRecord
points (-time) curDate current killed victor
View
@@ -184,11 +184,11 @@ largeLevelConfig d =
-- | Create a "normal" dungeon level. Takes a configuration in order
-- to tweak all sorts of data.
-level :: LevelConfig ->
+rogueroom :: LevelConfig ->
LevelName ->
Rnd (Maybe (Maybe DungeonLoc) -> Maybe (Maybe DungeonLoc) ->
Level, Loc, Loc)
-level cfg nm =
+rogueroom cfg nm =
do
lgrid <- levelGrid cfg
lminroom <- minRoomSize cfg
View
@@ -44,9 +44,10 @@ generate config session msg =
let matchGenerator n Nothing =
if n == 3 then bigroom else
if n == 10 then noiseroom else -- access to stairs may be blocked
- level
+ rogueroom
matchGenerator n (Just "bigroom") = bigroom
matchGenerator n (Just "noiseroom") = noiseroom
+ matchGenerator n (Just "rogueroom") = rogueroom
matchGenerator n (Just s) =
error $ "findGenerator: unknown: " ++ show n ++ ", " ++ s
View
@@ -63,6 +63,9 @@ getDungeonLevel ln (Dungeon dng) = (dng ! ln, Dungeon (M.delete ln dng))
putDungeonLevel :: Level -> Dungeon -> Dungeon
putDungeonLevel lvl (Dungeon dng) = Dungeon (M.insert (lname lvl) lvl dng)
+sizeDungeon :: Dungeon -> Int
+sizeDungeon (Dungeon dng) = M.size dng
+
instance Binary Dungeon where
put (Dungeon dng) = put (M.elems dng)
get = liftM dungeon get

0 comments on commit 7bd9ccf

Please sign in to comment.