Automatically update MAP_DYNAMIC if necessary #2069
Draft
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.
At the moment, the 128th map in any map group will be treated as
MAP_DYNAMICbecause it's read using only MAP_NUM. BecauseMAP_DYNAMICis in the middle of the map value range we can alleviate this problem a little by automatically increasing its value if there are sufficient maps in any map group. AlthoughMAP_GROUPisn't used in isolation to readMAP_DYNAMIC, we can do the same if there are sufficient map groups just in case.MAP_UNDEFINEDis read withMAP_GROUPin isolation, but it's already at the end of the value range.Also added error messages to
mapjsonif the number of maps or map groups exceeds the value range (including the space reserved forMAP_DYNAMICandMAP_UNDEFINED).Frustratingly the data type for map groups / map numbers is treated inconsistently and sometimes uses. (Addressed, see comment below)s8, so although these values are allowed to reach 255, there can be value range errors for values > 127. This problem is left unchanged by this PR