feat(gui): Show all available maps in the map list (previously limited to ~100)#2993
feat(gui): Show all available maps in the map list (previously limited to ~100)#2993pberthold wants to merge 1 commit into
Conversation
|
| 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 ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
The map list in Skirmish/LAN/Online is a list box whose capacity is defined by
LISTBOXDATA LENGTHin the corresponding
.wnd(for example100inWOLMapSelectMenu.wnd). When more maps areavailable 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
.wndfiles to a largerLENGTH.This change grows the map list in
populateMapListboxNoResetto the number of cached maps (only whenthat exceeds the current capacity), so every available map is listed.
GadgetListBoxSetListLengthreallocates 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
.wndcapacity (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.