Correctly update root status of item in _ilIsRoot
This commit is contained in:
+10
-1
@@ -17,6 +17,7 @@ module Dodge.Inventory (
|
||||
isFilteringInv,
|
||||
) where
|
||||
|
||||
import Dodge.SoundLogic
|
||||
import Control.Applicative
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
@@ -188,7 +189,8 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
Just (0, j) | j == i -> hud . hudElement . diSelection . _Just . _2 .~ k
|
||||
_ -> id
|
||||
return $
|
||||
w & cWorld . lWorld . creatures . ix 0 %~ updatecreature k
|
||||
w & checkdisconnect k
|
||||
& cWorld . lWorld . creatures . ix 0 %~ updatecreature k
|
||||
& updateselection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
@@ -196,6 +198,13 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0 -- the double application is inefficient, but necessary without further changes
|
||||
-- a rethink is maybe in order
|
||||
where
|
||||
cpos = fromMaybe 0 $ w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||
checkdisconnect k
|
||||
| a || b = soundStart InventorySound cpos disconnectItemS Nothing
|
||||
| otherwise = id
|
||||
where
|
||||
a = maybe False not $ w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix i . itLocation . ilIsRoot
|
||||
b = maybe False not $ w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix k . itLocation . ilIsRoot
|
||||
updatecreature k =
|
||||
(crInv %~ IM.safeSwapKeys i k)
|
||||
. (crManipulation . manObject . imSelectedItem .~ k)
|
||||
|
||||
Reference in New Issue
Block a user