Fix the navigational mesh not culling labels #6390
Merged
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.
Description of the proposed changes
Related to #5574 and #5579
In order to serialize the navigational mesh there can be no direct references to other leaves. This would turn it into a gigantic graph, which would cause the game to crash upon saving.
To fix this all references to a leaf are a number. This behaves similar to a pointer, where the number represents the index in a large list of leaves. When we loop over all the neighbors we therefore retrieve a number. And before we do any computations and/or table operations we should convert that number to the actual instance.
Which we did not do.
There's two underlying issues that should have prevented this, but it did not:
Testing done on the proposed changes
Start a game on a generated map (seed: neroxis_map_generator_1.12.3_7zoovyk44bxky_aqeaefam) and observe that the number of labels is reduced drastically (from 6226 to 2).
Behavior on the release branch (each isolated color is a separate area)
Behavior in this pull request