Fix bugs in equipment allocation using hotkeys
The behaviour is still not perfect, should be able to cycle through all options by pressing one key. There is unnecessary memory of past state going on here
This commit is contained in:
@@ -42,15 +42,15 @@ chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
|
||||
where
|
||||
hasnoequipment ep = isNothing $ cr ^? crEquipment . ix ep
|
||||
|
||||
getEquipmentAllocation :: World -> EquipmentAllocation
|
||||
getEquipmentAllocation w = fromMaybe DoNotMoveEquipment $ do
|
||||
curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix curpos . itUse . uequipEffect . eeType
|
||||
getEquipmentAllocation :: Int -> World -> EquipmentAllocation
|
||||
getEquipmentAllocation invid w = fromMaybe DoNotMoveEquipment $ do
|
||||
-- curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix invid . itUse . uequipEffect . eeType
|
||||
i <-
|
||||
w ^? rbOptions . opSel
|
||||
<|> Just (chooseEquipPosition (you w) (eqSiteToPositions esite))
|
||||
es <- eqSiteToPositions esite ^? ix i
|
||||
return $ case you w ^? crInv . ix curpos . itLocation . ilEquipSite . _Just of
|
||||
return $ case you w ^? crInv . ix invid . itLocation . ilEquipSite . _Just of
|
||||
Just epos
|
||||
| es == epos -> RemoveEquipment{_allocOldPos = epos}
|
||||
Just epos
|
||||
|
||||
Reference in New Issue
Block a user