Update StarCharSelection.cpp

This commit is contained in:
Kae 2024-06-25 19:56:19 +10:00
parent c046bd83d1
commit 67c7257c3b

View File

@ -77,14 +77,15 @@ void CharSelectionPane::updateCharacterPlates() {
auto updatePlayerLine = [this](String name, unsigned scrollPosition) {
auto charSelector = fetchChild<LargeCharPlateWidget>(name);
if (auto playerUuid = m_playerStorage->playerUuidAt(scrollPosition)) {
auto player = m_playerStorage->loadPlayer(*playerUuid);
player->humanoid()->setFacingDirection(Direction::Right);
charSelector->setPlayer(player);
charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); });
} else {
charSelector->setPlayer(PlayerPtr());
charSelector->disableDelete();
if (auto player = m_playerStorage->loadPlayer(*playerUuid)) {
player->humanoid()->setFacingDirection(Direction::Right);
charSelector->setPlayer(player);
charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); });
return;
}
}
charSelector->setPlayer(PlayerPtr());
charSelector->disableDelete();
};
updatePlayerLine("charSelector1", m_downScroll + 0);