Bind docked zones to live PlayerView to fix stale cards on new match#11192
Merged
tool4ever merged 2 commits intoJul 10, 2026
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tool4ever
reviewed
Jul 10, 2026
Root-cause fix for docked zone tabs showing the previous game's cards after "Start New Match". getLocalPlayers() returns gameControllers.keySet(), keyed by PlayerView (equality is by id). Desktop reuses the GUI across matches without clearing the map, so when setOriginalGameController re-registers the new game's live PlayerView, HashMap.put keeps the id-equal old key and only swaps the value -- keySet() then hands back the prior game's orphaned view, which never updates. registerZoneDocs binds docked zones to that stale view. Removing the id-equal entry before re-putting makes the live instance the key, so getLocalPlayers() returns live views for every consumer. Only the key changes; the value and all id-based lookups are untouched, so existing callers behave identically. Reverts the desktop-scoped registerZoneDocs workaround. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48cf2df to
7f15a52
Compare
tool4ever
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #11111.
Summary
Fixes docked zone tabs (e.g. "Playable Zone Cards") showing the previous game's cards after "Start New Match".
Bug report
With a zone view docked as a tab (rather than floating), starting a new match left the previous game's cards in the tab. They never cleared — persisting through the whole new game, even after drawing and playing. Floating zone windows were unaffected.
Root cause
At each game start,
CMatchUI.updatePlayerControlrebuilds the docked tabs viaFloatingZone.registerZoneDocs, binding eachVZoneto aPlayerViewfromgetLocalPlayers()(thegameControllerskey set). On restart the desktop reuses the sameCMatchUIwithout resetting controller state (only mobile callsresetForNewMatch), and the new game installs freshPlayerViewinstances. BecauseTrackableObjectequality is by id, re-registering the local player leaves theHashMap's original stale key in place — sogetLocalPlayers()returns an orphanedPlayerViewfrom the prior game that never receives updates. Floating windows dodge this by being rebuilt lazily on click against the live view.Fix
Source the local players from the live game view (
getGameView().getPlayers()filtered byisLocalPlayer) instead ofgetLocalPlayers(), so docked zones bind to the livePlayerViewand refresh correctly.Alternative considered
Resetting the reused controller state each game (mirroring mobile's
resetForNewMatch) would fix the root cause more broadly. It was not taken here because it lives in shared lifecycle code (AbstractGuiGame/HostedMatch) exercised by desktop, mobile, network host, and client — a much larger blast radius. This PR takes the lower-risk desktop-scoped fix.🤖 Generated with Claude Code