From 19e59279347a21c1d84bd2e69aa04cc8b590e1c9 Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 19 Dec 2024 01:49:13 +0000 Subject: [PATCH] Move towards removing crInvEquipped --- src/Dodge/Inventory/RBList.hs | 6 ++++-- src/Dodge/Inventory/SelectionList.hs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Dodge/Inventory/RBList.hs b/src/Dodge/Inventory/RBList.hs index 455959fcf..bbf270908 100644 --- a/src/Dodge/Inventory/RBList.hs +++ b/src/Dodge/Inventory/RBList.hs @@ -36,7 +36,8 @@ updateRBList w chooseEquipmentPosition :: Creature -> [EquipPosition] -> Int chooseEquipmentPosition cr eps = fromMaybe (chooseFreeSite cr eps) $ do i <- cr ^? crManipulation . manObject . imSelectedItem - ep <- cr ^? crInvEquipped . ix i + --ep <- cr ^? crInvEquipped . ix i + ep <- cr ^? crInv . ix i . itLocation . ilEquipPosition . _Just elemIndex ep eps chooseFreeSite :: Creature -> [EquipPosition] -> Int @@ -51,7 +52,8 @@ getEquipmentAllocation w = fromMaybe DoNotMoveEquipment $ do i <- w ^? rbOptions . opSel <|> Just (chooseEquipmentPosition (you w) (equipSiteToPositions esite)) es <- equipSiteToPositions esite ^? ix i - return $ case you w ^? crInvEquipped . ix curpos of + --return $ case you w ^? crInvEquipped . ix curpos of + return $ case you w ^? crInv . ix curpos . itLocation . ilEquipPosition . _Just of Just epos | es == epos -> RemoveEquipment{_allocOldPos = epos} Just epos diff --git a/src/Dodge/Inventory/SelectionList.hs b/src/Dodge/Inventory/SelectionList.hs index 510929931..3b2d4859c 100644 --- a/src/Dodge/Inventory/SelectionList.hs +++ b/src/Dodge/Inventory/SelectionList.hs @@ -32,7 +32,9 @@ invSelectionItem indent cr i ci = } where anyhotkey = maybe [] ((' ' :) . hotkeyToString) (cr ^? crInvHotkeys . ix i) - anyequippos = maybe [] (rightPad 8 ' ' . (' ' :) . eqPosText) (cr ^? crInvEquipped . ix i) + anyequippos = maybe [] (rightPad 8 ' ' . (' ' :) . eqPosText) + (ci ^? _1 . itLocation . ilEquipPosition . _Just) +-- (cr ^? crInvEquipped . ix i) col = itemInvColor ci pics = itemDisplay cr ci