Add IntMapHelper, locate wall cutting bug
This commit is contained in:
@@ -24,6 +24,7 @@ import Dodge.Item.Attachment.Data
|
||||
import Dodge.Item.Attachment
|
||||
import Geometry
|
||||
import Picture
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
--import Data.List
|
||||
--import Data.Char
|
||||
@@ -38,7 +39,6 @@ import Control.Monad.State
|
||||
import qualified SDL
|
||||
import System.Random
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import qualified Data.Map as M
|
||||
|
||||
pistol
|
||||
@@ -930,7 +930,7 @@ fireRemoteLauncher cid w = setLocation
|
||||
$ soundOnce (fromIntegral launcherSound)
|
||||
$ over projectiles remRocket w
|
||||
where
|
||||
i = newKey $ _projectiles w
|
||||
i = IM.newKey $ _projectiles w
|
||||
cr = _creatures w IM.! cid
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
|
||||
@@ -943,7 +943,7 @@ fireRemoteLauncher cid w = setLocation
|
||||
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
||||
}
|
||||
j = _crInvSel $ _creatures w IM.! cid
|
||||
newitid = newKey $ _itemPositions w
|
||||
newitid = IM.newKey $ _itemPositions w
|
||||
maybeitid = w ^? creatures . ix cid . crInv . ix j . itID . _Just
|
||||
resetFire = set (creatures . ix cid . crInv . ix j . wpFire)
|
||||
$ hammerCheck $ explodeRemoteRocket itid i
|
||||
@@ -1083,7 +1083,7 @@ throwRemoteBomb n w = setLocation $ removePict $ resetFire
|
||||
Nothing -> w' & creatures . ix n . crInv . ix j . itID ?~ newitid
|
||||
& itemPositions %~ IM.insert newitid (InInv n j)
|
||||
_ -> w'
|
||||
newitid = newKey $ _itemPositions w
|
||||
newitid = IM.newKey $ _itemPositions w
|
||||
itid = fromMaybe newitid maybeitid
|
||||
|
||||
explodeRemoteBomb :: Int -> Int -> Int -> World -> World
|
||||
@@ -1223,7 +1223,7 @@ spawnCrNextTo
|
||||
-> World
|
||||
spawnCrNextTo cr i w = w & creatures %~ IM.insert k newCr
|
||||
where
|
||||
k = newKey $ _creatures w
|
||||
k = IM.newKey $ _creatures w
|
||||
sCr = _creatures w IM.! i
|
||||
newCr = cr
|
||||
& crID .~ k
|
||||
|
||||
Reference in New Issue
Block a user