Card-Forge / Card-Forge/forge

Second slot in the online lobby has no avatar or sleeve

Open
#11,902 0 comments 0 reactions 1 assignee Claimed by @leriomaggio View on GitHub
GUI Netplay
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**

Image

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.