Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
When monitoring memory usage for the
overmap_terrain_coverage
test I noticed that a lot was taken up bymongroup
objects.Looking at these objects, they are extremely inefficient in their content. Each was 160 bytes, which is far larger than they needed to be.
In particular,
mongroup
had a lot of unnecessary point information. It contained its own position in both absolute and overmap-relative coordinates, which was clearly redundant. Also, thetarget
andnemesis_target
members were bothtripoint
s but only ever used the x and y members.Describe the solution
Remove the submap-relative position and add a member to deduce it from the absolute position.
Convert each target from
tripoint
topoint
.This reduces the total size of the struct from 160 bytes to 144 bytes.
Add new debugging output regarding mongroups to the overmap editor to help me test these changes.
Describe alternatives you've considered
There are more improvements possible, but this is a good start.
Testing
Unit tests pass.
I verified that an old save with mongroups loads in the new layout without errors.
Using the new debug output I verified that hordes can spawn and they do still move towards their targets.
Additional context