Permalink
Browse files

clean-up complete; operations on current level and all levels separated

  • Loading branch information...
1 parent b880066 commit 50f88bfe0f3598842fce337f1a55a12499027d43 @Mikolaj Mikolaj committed Mar 12, 2011
Showing with 5 additions and 4 deletions.
  1. +3 −4 src/Actions.hs
  2. +2 −0 src/State.hs
View
@@ -443,18 +443,17 @@ selectHero actor =
then return False -- already selected
else do
state <- get
- case findActorLevel actor state of
+ case findActorAnyLevel actor state of
Nothing -> abortWith $ "No such member of the party."
- Just nln -> do
+ Just (nln, pbody) -> do
-- Make the new actor the player-controlled actor.
modify (\ s -> s { splayer = actor })
-- Record the original level of the new player.
modify (updateCursor (\ c -> c { creturnLn = nln }))
-- Switch to the level.
lvlswitch nln
-- Announce.
- ptype <- gets (mtype . getPlayerBody)
- messageAdd $ subjectMovable ptype ++ " selected."
+ messageAdd $ subjectMovable (mtype pbody) ++ " selected."
return True
-- | Calculate loot's worth. TODO: move to another module, and refine significantly.
View
@@ -19,6 +19,8 @@ import Message
-- | The 'State' contains all the game state that has to be saved.
-- In practice, we maintain extra state, but that state is state
-- accumulated during a turn or relevant only to the current session.
+-- TODO: consider changing slevel to LevelName, removing the lname field
+-- and not removing the current level from the dungeon.
data State = State
{ splayer :: Actor, -- ^ represents the player-controlled movable
scursor :: Cursor, -- ^ cursor location and level to return to

0 comments on commit 50f88bf

Please sign in to comment.