Fix item location bug
This commit is contained in:
@@ -14,7 +14,9 @@ import Dodge.HeldUse
|
||||
import Dodge.Inventory
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Item.Location
|
||||
--import qualified IntMapHelp as IM
|
||||
|
||||
--note :: a -> Maybe b -> Either a b
|
||||
--note x = maybe (Left x) Right
|
||||
|
||||
useItem :: Int -> Int -> World -> Maybe World
|
||||
useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
||||
|
||||
@@ -32,7 +32,7 @@ data HUD = HUD
|
||||
, _diSelection :: Maybe Selection
|
||||
, _diInvFilter :: Maybe String
|
||||
, _diCloseFilter :: Maybe String
|
||||
, _closeItems :: [NewInt ItmInt]
|
||||
, _closeItems :: [NewInt ItmInt] -- add bool showing whether in ssSet?
|
||||
, _closeButtons :: [Int]
|
||||
, _manObject :: ManipulatedObject
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ data ItemLocation
|
||||
, _ilEquipSite :: Maybe EquipSite
|
||||
}
|
||||
| OnTurret {_ilTuID :: Int}
|
||||
| OnFloor {_ilCloseSel :: Bool} -- {_ilFlID :: NewInt FloorInt}
|
||||
| OnFloor
|
||||
| InVoid
|
||||
deriving (Eq, Show, Ord, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ data World = World
|
||||
, _wSoundFilter :: SoundFilter
|
||||
, _input :: Input
|
||||
, _testFloat :: Float
|
||||
, _testString :: String
|
||||
, _rbState :: RightButtonState
|
||||
, _hud :: HUD
|
||||
, _worldEventFlags :: Set WorldEventFlag
|
||||
|
||||
@@ -43,6 +43,7 @@ defaultWorld =
|
||||
, _playingSounds = M.empty
|
||||
, _randGen = mkStdGen 2
|
||||
, _testFloat = 0
|
||||
, _testString = ""
|
||||
, _rbState = NoRightButtonState
|
||||
, _hud = defaultHUD
|
||||
, _worldEventFlags = mempty
|
||||
|
||||
@@ -15,7 +15,7 @@ copyItemToFloor :: Point2 -> Item -> World -> World
|
||||
copyItemToFloor p it w =
|
||||
w'
|
||||
& cWorld . lWorld . floorItems . at (it ^. itID . unNInt) ?~ FlIt q r
|
||||
& cWorld . lWorld . items . at (it ^. itID . unNInt) ?~ (it & itLocation .~ OnFloor False)
|
||||
& cWorld . lWorld . items . at (it ^. itID . unNInt) ?~ (it & itLocation .~ OnFloor)
|
||||
& hud . closeItems .:~ _itID it -- puts item at top of close items
|
||||
& cWorld . highlightItems . at (it ^. itID . unNInt) ?~ 20
|
||||
where
|
||||
|
||||
@@ -273,7 +273,7 @@ invSetSelection sel w =
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
-- & crUpdateItemLocations
|
||||
& setInvPosFromSS -- is this necessary here?
|
||||
-- & crUpdateItemLocations
|
||||
& crUpdateItemLocations
|
||||
|
||||
invSetSelectionPos :: Int -> Int -> World -> World
|
||||
invSetSelectionPos i j = invSetSelection (Sel i j)
|
||||
|
||||
@@ -111,7 +111,7 @@ placeSpotID rid ps pt w = case pt of
|
||||
in ( i
|
||||
, w
|
||||
& gwWorld . cWorld . lWorld . floorItems . at i ?~ FlIt p rot
|
||||
& gwWorld . cWorld . lWorld . items . at i ?~ (itm & itID .~ NInt i & itLocation .~ OnFloor False)
|
||||
& gwWorld . cWorld . lWorld . items . at i ?~ (itm & itID .~ NInt i & itLocation .~ OnFloor)
|
||||
)
|
||||
PutCrit cr -> plNewUpID (gwWorld . cWorld . lWorld . creatures) crID (mvCr p rot cr) w
|
||||
PutForeground fs ->
|
||||
|
||||
@@ -58,10 +58,14 @@ crs :: Universe -> [Creature]
|
||||
crs u = u ^.. uvWorld . cWorld . lWorld . creatures . each
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit u = [u ^. uvWorld . input . mouseContext . to show
|
||||
testStringInit u =
|
||||
[ u ^. uvWorld . testString
|
||||
, u ^. uvWorld . input . mouseContext . to show
|
||||
, u ^. uvWorld . hud . diSelection . to show
|
||||
] <> u ^.. uvWorld . hud . diSections . each . ssSet . to show
|
||||
-- u ^. uvWorld . hud . manObject . to prettyShort
|
||||
, u ^. uvWorld . cWorld . lWorld . lInvLock . to show
|
||||
]
|
||||
<> u ^. uvWorld . hud . manObject . to prettyShort
|
||||
<> u ^.. uvWorld . hud . diSections . each . ssSet . to show
|
||||
--testStringInit u = u ^. uvWorld . cWorld . lWorld . creatures . ix 5 . crActionPlan . to prettyShort
|
||||
--[show . getSum $ foldMap (Sum . crslime) (crs u)]
|
||||
-- u ^.. tocrs . each . crType . slimeSplitTimer . to show
|
||||
|
||||
Reference in New Issue
Block a user