Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechange: Reduced size of water region by not storing tile area #12615

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kuhnovic
Copy link
Contributor

@Kuhnovic Kuhnovic commented May 3, 2024

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.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@Kuhnovic Kuhnovic changed the title Codechange: Reduced size of water region from 32 to 24 bytes Codechange: Reduced size of water region by not storing tile area May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant