Second slot in the online lobby has no avatar or sleeve
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 163
Description
**Describe the bug**
In the online lobby the second player slot shows no avatar image and no sleeve art,
whether it is set to AI or to Human.
`ServerGameLobby`'s constructor creates that slot with hardcoded -1 for both:
addSlot(new LobbySlot(LobbySlotType.LOCAL, localName(), localAvatarIndices()[0], localSleeveIndices()[0], 0, true, false, Collections.emptySet()));
addSlot(new LobbySlot(LobbySlotType.OPEN, null, -1, -1, 1, false, false, Collections.emptySet()));
-1 is the intended value while the seat is OPEN: `PlayerPanel:228` deliberately renders
the open-seat placeholder with it.
avatarLabel.setIcon(FSkin.getAvatars().get(type == LobbySlotType.OPEN ? -1 : avatarIndex));
The problem is that nothing replaces -1 when the seat stops being OPEN locally. A remote
player is fine, since `ServerGameLobby.connectPlayer` sets the avatar and sleeve the
client sends. A host switching that seat to AI or Human changes the type and leaves the
stored indices at -1, so the placeholder is what stays on screen.
The offline lobby gets this right, in the same package:
LocalLobby: new LobbySlot(LobbySlotType.AI, null, avatarIndices[1], sleeveIndices[1], 1, ...)
`localAvatarIndices()` and `localSleeveIndices()` already return arrays read from
`FPref.UI_AVATARS` and `FPref.UI_SLEEVES`, so index 1 is available and is what
`LocalLobby` uses. `GameLobby.addSlot()`, the Add player path, separately uses the slot
index for both, which is a third convention but at least a valid one.
**To Reproduce**
Steps to reproduce the behavior:
1. Open the online lobby as host
2. Set the second slot to AI, or to Human
3. It has no avatar and no sleeve art, while the first slot has both
**Expected behavior**
A seat that is no longer open should get a real avatar and sleeve, as the offline lobby's
second seat does. Ideally one distinct from the first player's; `VLobby:1126` has a
`getUsedAvatars()` that suggests distinct assignment was intended somewhere.
**Smartphone (please complete the following information):**
Same issue on mobile as well
**Screenshots**
Contributor guide
Assessment
This issue has not been assessed yet.