branchrust_reboot/main/playerinventory_oncycle_optimcancel
8 Commits over 0 Days - ∞cph!
Bugfix: fix leaking onCycle items when calling Item::Remove
- Consolidated onCycle callback cleanup to DoRemove
- ItemManager::DoRemoves(bool) can now force remove all items
- Added a unit test to validate the logc
Tests: ran unit test, cooked meat on a campfire, ate it, cooked again - no exception
Buildfix: add SERVER guards
Tests: none, trivial change
Bugfix: ItemCointainer loading items no longer throws due to stale itemsWithOnCycle
Fixed by resetting itemsWithOnCycle before population
Tests: unit tests
Update: add TestLoad that exposes a bug for caching onCycle
Still not the one I'm looking for, but would bite eventually
Tests: ran unit test - fails as expected
Update: add TestOnCycleStackables test to validate onCycle caching
Weirdly it passes with no duplicate-key exceptions. Maybe the exception is just a symptom, gonna check elsewhere
Tests: ran unit test
Optim: ItemContainer.OnCycle now uses cached list of items with a callback
- added a perf test of 300 containers with ~10% items with OnCycle callback
Goes from 0.179 ms down to 0.074ms(-58%) for 300 player inventories. Real world server's invoke times are 0.97ms for 171 inventories, so might need to move it out of invokes later.
Tests: ran unit test
Tests: add ItemContainer.TestOnCycle test
Tests: ran unit tests