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 updatePlayerLine = [this](String name, unsigned scrollPosition) {
auto charSelector = fetchChild<LargeCharPlateWidget>(name); auto charSelector = fetchChild<LargeCharPlateWidget>(name);
if (auto playerUuid = m_playerStorage->playerUuidAt(scrollPosition)) { if (auto playerUuid = m_playerStorage->playerUuidAt(scrollPosition)) {
auto player = m_playerStorage->loadPlayer(*playerUuid); if (auto player = m_playerStorage->loadPlayer(*playerUuid)) {
player->humanoid()->setFacingDirection(Direction::Right); player->humanoid()->setFacingDirection(Direction::Right);
charSelector->setPlayer(player); charSelector->setPlayer(player);
charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); }); charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(*playerUuid); });
} else { return;
charSelector->setPlayer(PlayerPtr()); }
charSelector->disableDelete();
} }
charSelector->setPlayer(PlayerPtr());
charSelector->disableDelete();
}; };
updatePlayerLine("charSelector1", m_downScroll + 0); updatePlayerLine("charSelector1", m_downScroll + 0);