Permalink
Browse files

add the cursor level field

  • Loading branch information...
1 parent ccfe246 commit 5f4a91c5f43a062ed32472d355ebb7f566598736 @Mikolaj Mikolaj committed Mar 20, 2011
Showing with 14 additions and 11 deletions.
  1. +1 −1 src/LambdaHack.hs
  2. +13 −10 src/State.hs
View
2 src/LambdaHack.hs
@@ -82,7 +82,7 @@ generate config session msg =
(Potion PotionHealing, White) ]
ploc = ((\ (_,x,_) -> x) (head levels))
hp = heroHP config
- defState = defaultState (AHero 0) ploc dng lvl
+ defState = defaultState (AHero 0) dng lvl
state = defState { sassocs = assocs, sconfig = config }
k = Config.get config "heroes" "extraHeroes"
addNamedHero state n = addHero ploc hp (findHeroName n) state n
View
23 src/State.hs
@@ -37,17 +37,18 @@ data State = State
deriving Show
data Cursor = Cursor
- { ctargeting :: Bool, -- ^ are we in targeting mode?
- clocation :: Loc, -- ^ cursor coordinates
- creturnLn :: LevelName -- ^ the level current player resides on
+ { ctargeting :: Bool, -- ^ are we in targeting mode?
+ clocLn :: LevelName, -- ^ cursor level
+ clocation :: Loc, -- ^ cursor coordinates
+ creturnLn :: LevelName -- ^ the level current player resides on
}
deriving Show
-defaultState :: Actor -> Loc -> Dungeon -> Level -> State
-defaultState pl ploc dng lvl =
+defaultState :: Actor -> Dungeon -> Level -> State
+defaultState pl dng lvl =
State
pl
- (Cursor False ploc (lname lvl))
+ (Cursor False (LambdaCave (-1)) (-1, -1) (lname lvl))
[]
Implicit Normal
0
@@ -193,17 +194,19 @@ instance Binary State where
(State player cursor hst sense disp time assocs discs dng lvl config)
instance Binary Cursor where
- put (Cursor act loc ln) =
+ put (Cursor act cln loc rln) =
do
put act
+ put cln
put loc
- put ln
+ put rln
get =
do
act <- get
+ cln <- get
loc <- get
- ln <- get
- return (Cursor act loc ln)
+ rln <- get
+ return (Cursor act cln loc rln)
data SensoryMode =
Implicit

0 comments on commit 5f4a91c

Please sign in to comment.