Fix bug in item loc when combining items, rethink centralizing item locs

This commit is contained in:
2024-09-24 18:07:25 +01:00
parent a6eb5cf982
commit 34c244a332
4 changed files with 8 additions and 3 deletions
+2 -1
View File
@@ -33,11 +33,12 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
Just
( i
, w
& updateItLocation i
& cWorld . lWorld . floorItems . unNIntMap %~ IM.delete (_unNInt $ _flItID flit)
& cWorld . lWorld . creatures . ix cid . crInv %~ IM.insert i it
& updateItLocation i
-- I forget whether using "at" rather than "IM.insert" here caused problems
-- & cWorld . lWorld . creatures . ix cid . crInv . at i ?~ it
& cWorld . lWorld %~ crUpdateItemLocations cid
& setInvPosFromSS
& cWorld . lWorld %~ crUpdateItemLocations cid
)