Skip to content

Commit

Permalink
bugfix: cycle heroes was off by one
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj committed Mar 14, 2011
1 parent 477519c commit b1e07d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ cycleHero =
do
pl <- gets splayer
hs <- gets (lheroes . slevel)
let i = case pl of AHero n -> n ; _ -> 0
let i = case pl of AHero n -> n + 1 ; _ -> 0
(lt, gt) = L.splitAt i (IM.assocs hs)
case gt ++ lt of
[] -> abortWith "Cannot select another hero on this level."
(ni, _) : _ -> assertTrue $ selectHero (AHero ni)
(ni, _) : _ : _ -> assertTrue $ selectHero (AHero ni)
_ -> abortWith "Cannot select another hero on this level."

-- | Selects a hero based on the number (actor, actually).
-- Focuses on the hero if level changed. False, if nothing to do.
Expand Down

0 comments on commit b1e07d2

Please sign in to comment.