jmapgen_terrain: use string ids #83013
Merged
+3
−3
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
Bugfixes "Fix terrain not being recognized in palettes based on loading order"
Purpose of change
Fixes #82974
Because conversion to an int_id requires that the object of that type is already loaded, values loaded from JSON should be loaded as string ids, then converted to int ids on use or after all JSON has been loaded.
Because jmapgen_terrain did not do this, if terrain definitions were placed such that they were loaded after the palette the jmapgen_terrain is part of, it would not be able to convert them to a valid int id.
Describe the solution
Use string ids instead of int ids.
This was triggered in the innawood mod, and was resolved by moving the terrain defintions. Now that they are fixed, they can be restored to their previous location.
I want to do memory profiling to see the impact of this change. There are also probably other jmapgens that need to use string ids.
Testing
The innawood mod loads without any errors.