Codechange: Reduced size of water region by not storing tile area #12615
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.
Motivation / Problem
Recently there was some discussion on discord about the size of water regions. It was first reduced in #12278 and a bit more in #12560. In 12278 it was also suggested that we can get rid of the tile_area and further reduce the size. That's what this PR covers.
Description
The size of WaterRegionData (the class that's actually stored during the game) is reduced from 32 bytes to 24 bytes.
These changes are inspired by JGRennison/OpenTTD-patches@fdb7d7b. I took a slightly different route by keeping the OrthogonalTileArea, but instead of storing it it's created / used on the fly. It provides the contain function and tile iterators which are very convenient for what I'm doing, I'd rather not duplicate that logic if it can be avoided.
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.