Skip to content

Commit

Permalink
revert a part of "abort some actions with an empty message"
Browse files Browse the repository at this point in the history
This reverts q part of commit 3cd423e
concerning running, because the message for the last move of running
was being lost.
  • Loading branch information
Mikolaj committed Aug 4, 2011
1 parent a03cc33 commit 2fe2852
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ continueRun dir =
exit _ = False
let hop t
| monstersVisible || heroThere
|| newsReported || itemsHere || exit t = abortWith msg
|| newsReported || itemsHere || exit t = abort
hop Corridor =
-- in corridors, explore all corners and stop at all crossings
-- TODO: even in corridors, stop if you run past an exit (rare)
Expand All @@ -199,16 +199,16 @@ continueRun dir =
case L.filter (\ x -> not $ diagonal x) ns of
[ortoDir]
| allCloseTo ortoDir -> run ortoDir
_ -> abortWith msg
_ -> abort
hop _ -- outside corridors, never change direction
| not dirOK = abortWith msg
| not dirOK = abort
hop _ =
let ns = L.filter (\ x -> x /= dir && distance (neg dir, x) > 1) moves
ls = L.map (loc `shift`) ns
as = L.filter (\ x -> accessible lmap loc x
|| openable 1 lmap x) ls
ts = L.map (tterrain . (lmap `at`)) as
in if L.any exit ts then abortWith msg else run dir
in if L.any exit ts then abort else run dir
hop (tterrain t)

ifRunning :: (Dir -> Action a) -> Action a -> Action a
Expand Down

0 comments on commit 2fe2852

Please sign in to comment.