Make equipment indices point to item indices

This commit is contained in:
2025-08-26 23:57:02 +01:00
parent 49efe62910
commit 06d50ac752
18 changed files with 108 additions and 522 deletions
+4 -3
View File
@@ -49,9 +49,9 @@ chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
getEquipmentAllocation :: NewInt InvInt -> World -> EquipmentAllocation
getEquipmentAllocation invid w = fromMaybe DoNotMoveEquipment $ do
esite <- you w ^? crInv . ix invid >>= \k -> w ^? cWorld . lWorld . items . ix k >>= equipType-- . itUse . uequipEffect . eeType
i <-
w ^? rbOptions . opSel
itid <- you w ^? crInv . ix invid
esite <- w ^? cWorld . lWorld . items . ix itid >>= equipType
i <- w ^? rbOptions . opSel
<|> Just (chooseEquipPosition (w ^. cWorld . lWorld . items) (you w) (eqSiteToPositions esite))
es <- eqSiteToPositions esite ^? ix i
return $ case you w ^? crInv . ix invid >>= \k -> w ^? cWorld . lWorld . items . ix k . itLocation . ilEquipSite . _Just of
@@ -76,6 +76,7 @@ getEquipmentAllocation invid w = fromMaybe DoNotMoveEquipment $ do
, _allocRemoveID = _crEquipment (you w) M.! es
}
Nothing -> PutOnEquipment{_allocNewPos = es}
where
eqSiteToPositions :: EquipType -> [EquipSite]
eqSiteToPositions es = case es of