Skip to content

bugfix(worldbuilder): Keep new and resized maps within the map size limit - #3501

Open
tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/worldbuilder-map-size
Open

tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/worldbuilder-map-size

Conversation

@tintinhamans

@tintinhamans tintinhamans commented Oct 13, 2026 •

Copy link
Copy Markdown

⚠️ Merge after: #3486


The new map and resize dialog accepts any size, so WorldBuilder could create and save maps the loader rejects. isValidMapSize now applies MAX_MAP_DIMENSION and MAX_MAP_AREA to the map plus its border in the dialog, resize and the saved defaults, and the dialog warns above 1024x1024.

resize also frees its arrays with delete[] and clears the new flip and cliff state.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e976b83-f7a2-4c62-aef0-41e3046edd65
📥 Commits

Reviewing files that changed from the base of the PR and between 679d8f2 and 17859d5.

📒 Files selected for processing: 4
  • Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
  • Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
  • GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Both WorldBuilder variants add shared map-size validation. The check is used when constructing or resizing maps, submitting new-map dimensions, and applying configured defaults. Resizing also changes height-data allocation and array handling.

Changes

Height-map validation

Layer / File(s) Summary
Editor validation and resizing
Generals*/Code/Tools/WorldBuilder/include/WHeightMapEdit.h, Generals*/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp
Both variants add isValidMapSize and use it for construction and resizing. Resizing allocates an extra row for height data, uses array deletion, and zero-initializes new cliff and flip state arrays.
Map creation and default dimensions
Generals*/Code/Tools/WorldBuilder/src/NewHeightMap.cpp, Generals*/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp
New-map dialogs reject invalid dimensions and prompt for confirmation when the border-inclusive area exceeds 1024 × 1024. New-document setup resets invalid extents to 100 × 100 and the border width to 30.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: cryotherenegade

Merge Risk: ⚪ Minimal · up to 17859

The reported overflow concern cannot occur under the current map-size limits. No actionable merge-blocking risk is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description accurately summarizes the map-size validation, 1024×1024 warning, array deallocation, and state initialization changes.
Title check Passed The title clearly identifies the main change: keeping new and resized WorldBuilder maps within the map-size limit.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-map-size branch from ba592df to e9975d0 Compare October 13, 2026 08:55
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

This PR keeps new and resized maps within the loader’s size limits in both WorldBuilder versions.

  • New and resized maps stay within the loader’s size limits.
  • The size dialog warns before maps exceed 1024 × 1024 cells.
  • Resizing gives map data extra space and clears its cell flags.

No actionable new issues were found.

Reviews (7) · Last reviewed commit: "bugfix(worldbuilder): Keep new and resiz..." · Reviewed by Greptile

@tintinhamans tintinhamans added Bug Something is not working right, typically is user facing WorldBuilder Relates to World Builder Gen Relates to Generals ZH Relates to Zero Hour Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker labels Oct 13, 2026
@Mauller

Mauller commented Oct 13, 2026 •

Copy link
Copy Markdown

As WWB2 mentioned in the other PR, we might want to limit the map Area rather than hard limit dimensions, since it's the overall area that causes problems and not just individual dimensions.

So the Max area being 4096 squared etc

@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-map-size branch from e9975d0 to 679d8f2 Compare October 13, 2026 13:16
@tintinhamans

Copy link
Copy Markdown
Author

As WWB2 mentioned in the other PR, we might want to limit the map Area rather than hard limit dimensions, since it's the overall area that causes problems and not just individual dimensions.

So the Max area being 4096 squared etc

The limit is now an area of 4096x4096. Each side is still capped at 8192 because shoreline tiles pack coordinates into 16 bits and the shroud texture spans the map.

Comment thread GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-map-size branch 2 times, most recently from df25ef5 to c12b922 Compare October 13, 2026 19:04
Comment thread Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp Outdated
Comment thread Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-map-size branch from c12b922 to a72fd31 Compare October 13, 2026 19:23

@Mauller Mauller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xezon

xezon commented Oct 15, 2026

Copy link
Copy Markdown

Needs rebase?

@tintinhamans
tintinhamans force-pushed the arctic/fix/worldbuilder-map-size branch from a72fd31 to 17859d5 Compare October 15, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker WorldBuilder Relates to World Builder ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants