Made inbounds use map parameters #73503
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.
Summary
None
Purpose of change
Make 'inbounds' use the map parameters rather than hard coded overloaded operations using those same values.
Describe the solution
Changed the map::inbounds operations to check against the map's own parameters rather than hard coded limits that are the same as the map's at the time the code is written. This means tinymap can just call the map operations rather than overload them.
Removed confusing hard coded open cuboid checks against OVERMAP_HEIGHT +1 and replaced these with map::inbounds checks instead. If the reality bubble is expanded in the future, there's one less bug to find (looks like somebody really wanted to find a use for the cuboid stuff).
Removed a couple of weird usages of inbounds_z, where they really were used as "has the value changed from the initial value?" checks, which just is confusing.
Describe alternatives you've considered
Change inbounds_z to return false if the Z value isn't the map's Z value when Z levels aren't supported and use that in the inbounds checks. Reverted that because there might be some flaky tinymap using code that does stuff with caches anyway when the Z level is off (and it was a mistake to commit the changed code originally).
Testing
Load a save and walk around a bit. The changes should make no functional difference.
Additional context