Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bugfix: fast monsters desynchronized the party by attacking not selec…

…ted heroes
  • Loading branch information...
commit a8b32f4a1f41695dcffc7aada7db060d6e1d515b 1 parent e9a9cd4
Mikolaj Konarski Mikolaj authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/Action.hs
15 src/Action.hs
View
@@ -4,6 +4,7 @@ module Action where
import Control.Monad
import Control.Monad.State hiding (State)
import Data.List as L
+import qualified Data.IntMap as IM
-- import System.IO (hPutStrLn, stderr) -- just for debugging
import Perception
@@ -243,10 +244,16 @@ updatePlayerBody f = do
-- | Advance the move time for the given actor.
advanceTime :: Actor -> Action ()
-advanceTime actor =
- do
- time <- gets stime
- updateAnyActor actor $ \ m -> m { mtime = time + (nspeed (mkind m)) }
+advanceTime actor = do
+ time <- gets stime
+ let upd m = m { mtime = time + (nspeed (mkind m)) }
+ -- A hack to synchronize the whole party:
+ pl <- gets splayer
+ if (actor == pl || isAHero actor)
+ then do
+ modify (updateLevel (updateHeroes (IM.map upd)))
+ when (not $ isAHero pl) $ updatePlayerBody upd
+ else updateAnyActor actor upd
playerAdvanceTime :: Action ()
playerAdvanceTime = do
Please sign in to comment.
Something went wrong with that request. Please try again.