Move equipType out of record

This commit is contained in:
2025-06-05 13:52:36 +01:00
parent 1293aa0fdf
commit c8d44fea79
14 changed files with 123 additions and 164 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ module Dodge.Inventory.RBList (
eqSiteToPositions,
) where
import Dodge.Data.EquipType
import Control.Applicative
import Control.Lens
import Data.List (elemIndex, findIndex)
@@ -19,7 +20,7 @@ updateRBList w = case w ^. rbOptions of
EquipOptions{} -> w
_ -> fromMaybe (w & rbOptions .~ NoRightButtonOptions) $ do
i <- cr ^? crManipulation . manObject . imSelectedItem
esite <- cr ^? crInv . ix i . itUse . uequipEffect . eeType
esite <- cr ^? crInv . ix i >>= equipType -- . itUse . uequipEffect . eeType
return $
w & rbOptions
.~ EquipOptions
@@ -44,7 +45,7 @@ chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
getEquipmentAllocation :: Int -> World -> EquipmentAllocation
getEquipmentAllocation invid w = fromMaybe DoNotMoveEquipment $ do
esite <- you w ^? crInv . ix invid . itUse . uequipEffect . eeType
esite <- you w ^? crInv . ix invid >>= equipType-- . itUse . uequipEffect . eeType
i <-
w ^? rbOptions . opSel
<|> Just (chooseEquipPosition (you w) (eqSiteToPositions esite))