From bbf95c91d8c811d8d4c7bd6663081d00f2eea5c2 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 25 Nov 2024 15:22:42 +0000 Subject: [PATCH] Tweak item dropping --- ghcidOutput | 2 +- src/Dodge/FloorItem.hs | 1 + src/Dodge/Update/Input/InGame.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index d560b8d96..469709bcd 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 15:00:52) +All good (594 modules, at 15:18:36) diff --git a/src/Dodge/FloorItem.hs b/src/Dodge/FloorItem.hs index 2eed88aa6..734c599a6 100644 --- a/src/Dodge/FloorItem.hs +++ b/src/Dodge/FloorItem.hs @@ -24,6 +24,7 @@ copyItemToFloorID pos it w = w' & cWorld . lWorld . floorItems . unNIntMap %~ IM.insert flid theflit & cWorld . lWorld . itemLocations %~ IM.insert (_unNInt $ _itID it) (OnFloor $ NInt flid) + & hud . closeItems %~ (NInt flid:) where (p', w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w rot = fst . randomR (- pi, pi) $ _randGen w diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index b3437d7c9..f55afee61 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -111,7 +111,7 @@ tryDropSelected mpos w = do cr <- w ^? cWorld . lWorld . creatures . ix 0 (0, _) <- w ^? hud . hudElement . diSelection . _Just xs <- w ^? hud . hudElement . diSelectionExtra - return $ IS.foldr (dropItem cr) w xs + return . foldl' (flip $ dropItem cr) w . IS.toDescList $ xs tryPickupSelected :: Int -> Maybe (Int,Int) -> World -> Maybe World tryPickupSelected k mpos w = do