Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -10,28 +10,28 @@ import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
crIXsNearPoint :: Point2 -> World -> IS.IntSet
|
||||
crIXsNearPoint p w = zoneExtract (zoneOfPoint crZoneSize p) (w ^. cWorld . crZoning)
|
||||
crIXsNearPoint p w = zoneExtract (zoneOfPoint crZoneSize p) (w ^. cWorld . lWorld . crZoning)
|
||||
|
||||
crsNearPoint :: Point2 -> World -> [Creature]
|
||||
crsNearPoint p w = mapMaybe (\cid -> w ^? cWorld . creatures . ix cid) . IS.toList $ crIXsNearPoint p w
|
||||
crsNearPoint p w = mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid) . IS.toList $ crIXsNearPoint p w
|
||||
|
||||
crsNearSeg :: Point2 -> Point2 -> World -> [Creature]
|
||||
crsNearSeg sp ep w =
|
||||
mapMaybe (\cid -> w ^? cWorld . creatures . ix cid)
|
||||
mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid)
|
||||
. IS.toList
|
||||
$ crixsNearSeg sp ep w
|
||||
|
||||
crixsNearSeg :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
crixsNearSeg sp ep w = zonesExtract (w ^. cWorld . crZoning) (zoneOfSeg crZoneSize sp ep)
|
||||
crixsNearSeg sp ep w = zonesExtract (w ^. cWorld . lWorld . crZoning) (zoneOfSeg crZoneSize sp ep)
|
||||
|
||||
crIXsNearCirc :: Point2 -> Float -> World -> IS.IntSet
|
||||
crIXsNearCirc p r = crsNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
|
||||
crsNearCirc :: Point2 -> Float -> World -> [Creature]
|
||||
crsNearCirc p r w = mapMaybe (\cid -> w ^? cWorld . creatures . ix cid) . IS.toList $ crIXsNearCirc p r w
|
||||
crsNearCirc p r w = mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid) . IS.toList $ crIXsNearCirc p r w
|
||||
|
||||
crsNearRect :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
crsNearRect sp ep w = zonesExtract (w ^. cWorld . crZoning) $ zoneOfRect' crZoneSize sp ep
|
||||
crsNearRect sp ep w = zonesExtract (w ^. cWorld . lWorld . crZoning) $ zoneOfRect' crZoneSize sp ep
|
||||
|
||||
crZoneSize :: Float
|
||||
crZoneSize = 15
|
||||
@@ -43,7 +43,7 @@ minCrIXOn :: Ord a => (Creature -> a) -> IS.IntSet -> World -> Maybe Creature
|
||||
minCrIXOn f is w = fst <$> IS.foldl' g Nothing is
|
||||
where
|
||||
g mcrx cid = minOn snd <$> getpair cid <*> mcrx
|
||||
getpair cid = fmap h $ w ^? cWorld . creatures . ix cid
|
||||
getpair cid = fmap h $ w ^? cWorld . lWorld . creatures . ix cid
|
||||
h cr = (cr, f cr)
|
||||
|
||||
zoneCreature :: Creature -> IM.IntMap (IM.IntMap IS.IntSet) -> IM.IntMap (IM.IntMap IS.IntSet)
|
||||
|
||||
Reference in New Issue
Block a user