Make equipment indices point to item indices
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user