ACE3
ACE3 copied to clipboard
Medical - Change medical to use hashmaps for wound storage
When merged this pull request will:
- We most frequently want to access wounds by body part, so this makes that a constant time lookup.
- The body part index is no longer stored in every wound since it's inherent in the wound storage.
- Using body part names as the keys of the hashmap to improve code clarity (no more magic numbers).
closes #6468
I've tested these relevant parts of medical which access the wound structures:
- [x] Wound creation still works.
- [x] Menu and action displays still work.
- [x] Damage effect updates (limping).
- [x] Bandaging still works.
- [x] Stitching still works (inc. testing incremental behaviour).
- [x] Wound reopening still works.
- [x] AI treatment still works.
- [x] Litter creation still works.
IMPORTANT
- [x] If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
- [x] Development Guidelines are read, understood and applied.
- [x] Title of this PR uses our standard template
Component - Add|Fix|Improve|Change|Make|Remove {changes}
.
The most awkward part to rework with hashmaps was stitching so give that code particular attention when reviewing. I've tested it pretty extensively though.
One consideration I just had is that this will break de-serialization across versions. I should probably add some migration code there to convert any array into a hashmap appropriately.
Removed comment, raised in https://github.com/acemod/ACE3/issues/9244