Automatically update MAP_DYNAMIC if necessary #2069
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_DYNAMIC
because it's read using only MAP_NUM. BecauseMAP_DYNAMIC
is 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_GROUP
isn't used in isolation to readMAP_DYNAMIC
, we can do the same if there are sufficient map groups just in case.MAP_UNDEFINED
is read withMAP_GROUP
in isolation, but it's already at the end of the value range.Also added error messages to
mapjson
if the number of maps or map groups exceeds the value range (including the space reserved forMAP_DYNAMIC
andMAP_UNDEFINED
). Frustratingly the data type for map groups / map numbers is treated inconsistently and sometimes usess8
, 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.This is targeting the
porymap-6
branch for now because at the moment Porymap is (unnecessarily) overwriting themap_groups.h
file.