diff --git a/source/frontend/StarTeamBar.cpp b/source/frontend/StarTeamBar.cpp index a378040..f34961b 100644 --- a/source/frontend/StarTeamBar.cpp +++ b/source/frontend/StarTeamBar.cpp @@ -132,7 +132,7 @@ void TeamBar::updatePlayerResources() { m_energyBar->setColor(m_energyBarColor.mix(m_energyBarRegenMixColor, player->energyRegenBlockPercent())); } - m_nameLabel->setText(m_client->mainPlayer()->name()); + m_nameLabel->setText(player->name()); } void TeamBar::inviteButton() { diff --git a/source/frontend/StarTeleportDialog.cpp b/source/frontend/StarTeleportDialog.cpp index 01c6a69..c1ca4b4 100644 --- a/source/frontend/StarTeleportDialog.cpp +++ b/source/frontend/StarTeleportDialog.cpp @@ -79,7 +79,7 @@ TeleportDialog::TeleportDialog(UniverseClientPtr client, if (config.getBool("includePartyMembers", false)) { auto teamClient = m_client->teamClient(); for (auto member : teamClient->members()) { - if (member.uuid == m_client->mainPlayer()->uuid() || member.warpMode == WarpMode::None) + if (member.uuid == m_client->clientContext()->playerUuid() || member.warpMode == WarpMode::None) continue; auto entry = destList->addItem(); diff --git a/source/game/StarTeamClient.cpp b/source/game/StarTeamClient.cpp index f5cbfdc..c1e2751 100644 --- a/source/game/StarTeamClient.cpp +++ b/source/game/StarTeamClient.cpp @@ -28,7 +28,7 @@ TeamClient::TeamClient(PlayerPtr mainPlayer, ClientContextPtr clientContext) { bool TeamClient::isTeamLeader() { if (!m_teamUuid) return false; - return m_teamLeader == m_mainPlayer->uuid(); + return m_teamLeader == m_clientContext->playerUuid(); } bool TeamClient::isTeamLeader(Uuid const& playerUuid) { @@ -47,7 +47,7 @@ void TeamClient::invitePlayer(String const& playerName) { JsonObject request; request["inviteeName"] = playerName; - request["inviterUuid"] = m_mainPlayer->uuid().hex(); + request["inviterUuid"] = m_clientContext->playerUuid().hex(); request["inviterName"] = m_mainPlayer->name(); invokeRemote("team.invite", request, [](Json) {}); } @@ -55,7 +55,7 @@ void TeamClient::invitePlayer(String const& playerName) { void TeamClient::acceptInvitation(Uuid const& inviterUuid) { JsonObject request; request["inviterUuid"] = inviterUuid.hex(); - request["inviteeUuid"] = m_mainPlayer->uuid().hex(); + request["inviteeUuid"] = m_clientContext->playerUuid().hex(); invokeRemote("team.acceptInvitation", request, [this](Json) { forceUpdate(); }); } @@ -77,7 +77,7 @@ void TeamClient::makeLeader(Uuid const& playerUuid) { void TeamClient::removeFromTeam(Uuid const& playerUuid) { if (!m_teamUuid) return; - if (!isTeamLeader() && playerUuid != m_mainPlayer->uuid()) + if (!isTeamLeader() && playerUuid != m_clientContext->playerUuid()) return; JsonObject request; request["teamUuid"] = m_teamUuid->hex(); @@ -101,7 +101,7 @@ void TeamClient::update() { if (Time::monotonicTime() - m_pollInvitationsTimer > Root::singleton().assets()->json("/interface.config:invitationPollInterval").toFloat()) { m_pollInvitationsTimer = Time::monotonicTime(); JsonObject request; - request["playerUuid"] = m_mainPlayer->uuid().hex(); + request["playerUuid"] = m_clientContext->playerUuid().hex(); invokeRemote("team.pollInvitation", request, [this](Json response) { if (response.isNull()) return; @@ -131,7 +131,7 @@ void TeamClient::pullFullUpdate() { return; m_fullUpdateRunning = true; JsonObject request; - request["playerUuid"] = m_mainPlayer->uuid().hex(); + request["playerUuid"] = m_clientContext->playerUuid().hex(); invokeRemote("team.fetchTeamStatus", request, [this](Json response) { m_fullUpdateRunning = false; @@ -212,7 +212,7 @@ void TeamClient::handleRpcResponses() { } void TeamClient::writePlayerData(JsonObject& request, PlayerPtr player, bool fullWrite) const { - request["playerUuid"] = player->uuid().hex(); + request["playerUuid"] = m_clientContext->playerUuid().hex(); request["entity"] = player->entityId(); request["health"] = player->health() / player->maxHealth(); request["energy"] = player->energy() / player->maxEnergy(); diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp index 2ff4631..4f1dc27 100644 --- a/source/game/StarUniverseClient.cpp +++ b/source/game/StarUniverseClient.cpp @@ -394,7 +394,7 @@ CelestialCoordinate UniverseClient::shipCoordinate() const { } bool UniverseClient::playerOnOwnShip() const { - return playerWorld().is() && playerWorld().get() == mainPlayer()->uuid(); + return playerWorld().is() && playerWorld().get() == m_clientContext->playerUuid(); } bool UniverseClient::playerIsOriginal() const { @@ -412,7 +412,7 @@ bool UniverseClient::isAdmin() const { Uuid UniverseClient::teamUuid() const { if (auto team = m_teamClient->currentTeam()) return *team; - return m_mainPlayer->uuid(); + return m_clientContext->playerUuid(); } WorldTemplateConstPtr UniverseClient::currentTemplate() const {