Steps towards making clouds list based
This commit is contained in:
+4
-5
@@ -109,14 +109,13 @@ creaturesNearPointI n p w = IM.unions [f b $ f a $ _creaturesZone w | a<-[x-n..
|
||||
Just val -> val
|
||||
_ -> IM.empty
|
||||
|
||||
cloudsNearPoint :: Point2 -> World -> IM.IntMap Cloud
|
||||
cloudsNearPoint :: Point2 -> World -> [Cloud]
|
||||
--cloudsNearPoint p w = IM.unions [f b $ f a $ _cloudsZone w | a<-[x-1,x,x+1] , b<-[y-1,y,y+1]]
|
||||
cloudsNearPoint p w = f y $ f x $ _cloudsZone w
|
||||
cloudsNearPoint p w = f ((IM.lookup x $ _cloudsZone w) >>= IM.lookup y)
|
||||
where
|
||||
(x,y) = cloudZoneOfPoint p
|
||||
f i m = case IM.lookup i m of
|
||||
Just val -> val
|
||||
_ -> IM.empty
|
||||
f Nothing = []
|
||||
f (Just l) = l
|
||||
-- possible BUG, occurs when used in thingsHitLongLine
|
||||
creaturesAlongLine :: Point2 -> Point2 -> World -> IM.IntMap Creature
|
||||
--creaturesAlongLine a b w = IM.unions [f y $ f x $ _creaturesZone w | (x,y) <- zoneOfLine a b]
|
||||
|
||||
Reference in New Issue
Block a user