Permalink
Browse files

fix monsters unable to attack selected hero

I misuderstood how the action monad "abort" propagates through nested actions.
  • Loading branch information...
1 parent 4f4fa31 commit 790861cbe68c524a4b30c9a37b4e579dd80f1f7d @Mikolaj Mikolaj committed Feb 4, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/Actions.hs
View
@@ -328,9 +328,9 @@ swapCurrentHero (ni, np) =
player <- gets splayer
let i = heroNumber player
upd hs = IM.insert i player $ IM.delete ni hs
- when (ni == i) abort
- modify (updateLevel (updateHeroes upd))
- modify (updatePlayer (const np))
+ when (ni /= i) (do
+ modify (updateLevel (updateHeroes upd))
+ modify (updatePlayer (const np)))
-- | Calculate loot's worth. TODO: move to another module, and refine significantly. TODO: calculate for all heroes on the current level.
calculateTotal :: Hero -> Int

0 comments on commit 790861c

Please sign in to comment.