Skip to content

feat(gui): Show all available maps in the map list (previously limited to ~100)#2993

Open
pberthold wants to merge 1 commit into
TheSuperHackers:mainfrom
pberthold:feat/map-list-capacity
Open

feat(gui): Show all available maps in the map list (previously limited to ~100)#2993
pberthold wants to merge 1 commit into
TheSuperHackers:mainfrom
pberthold:feat/map-list-capacity

Conversation

@pberthold

Copy link
Copy Markdown

The map list in Skirmish/LAN/Online is a list box whose capacity is defined by LISTBOXDATA LENGTH
in the corresponding .wnd (for example 100 in WOLMapSelectMenu.wnd). When more maps are
available than that capacity, the surplus maps are simply not added to the list — they are silently
missing, with no error. This is a long-standing annoyance, usually worked around by hand-editing the
.wnd files to a larger LENGTH.

This change grows the map list in populateMapListboxNoReset to the number of cached maps (only when
that exceeds the current capacity), so every available map is listed. GadgetListBoxSetListLength
reallocates the list and copies the existing rows, so this is a safe resize, not an out-of-bounds
write. Since the change lives in the shared MapUtil.cpp, it applies to both Generals and Zero Hour,
and to every game mode and mod.

Verification: Built with the VC6 Docker toolchain and tested in-game (Skirmish, base game and
mods) with a ~470-map collection: all maps are now listed, whereas before the list stopped at its
.wnd capacity (about 100).

AI assistance: This change was drafted with AI assistance (Claude), then reviewed, adjusted and
tested by me. An initial draft used a fixed capacity value; I changed it to size the list to the
actual map count so the result is genuinely unbounded, and verified it in-game.

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR grows the map list capacity before adding cached maps. The main changes are:

  • Sizes the listbox to the current map cache when the cache is larger than the window-defined length.
  • Keeps the existing early returns for missing map cache or listbox.
  • Applies the resize in the shared map-list population helper.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
Core/GameEngine/Source/GameClient/MapUtil.cpp Adds a pre-population listbox resize based on TheMapCache->size() so larger map collections fit in the UI list.

Reviews (1): Last reviewed commit: "feat(gui): Show all available maps in th..." | Re-trigger Greptile

// LENGTH and caps large collections (Skirmish/LAN/Online, all titles and mods).
const Int neededListLength = (Int)TheMapCache->size();
if (neededListLength > GadgetListBoxGetListLength( listbox ))
GadgetListBoxSetListLength( listbox, neededListLength );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We had this change proposal before. This means it overwrites the map length value from the WND file, which is unexpected.

So if WND file sets length 1000 and 100000 maps do physically exist, then this code list will allocate for 100000 maps and not 1000.

We need a better solution than this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review and the context, @xezon — and sorry for the duplicate. #760 and #1758 are both about the Replay menu, so they didn't come up when I searched for the map list. Having read them now, I understand the issues this idea raises.

The reason I bothered at all: the stock lists ship at 100 (LAN/Online), 200 (MapSelect) and 300 (Skirmish), and even mods like ShockWave carry the exact same numbers untouched — although a higher number of maps works like a charm. So the 100 on the LAN/Online lists mostly just hides maps people already have. Feels less like a deliberate cap and more like a default nobody ever revisited.

One idea before I let it go, though: instead of overriding anything, an opt-in GameData.ini value — default keeps today's behaviour exactly, a positive number lets a user raise the limit at their own risk (clamped to the maps they actually have, so it can't over-allocate). Since the .wnd files aren't in this repo anyway, a code-side setting is really the only place the engine could offer that choice without shipping modified assets.

If that's not something you'd want either, no worries — I'll keep it local like you suggested and close this out. Thanks either way for taking the time.

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.

2 participants