Use player name from RemoteKartInfo

This commit is contained in:
Benau
2018-12-29 14:05:28 +08:00
parent 9068483d56
commit c6b3fba304

View File

@@ -34,7 +34,6 @@
#include "network/network_config.hpp"
#include "network/network_player_profile.hpp"
#include "network/network_string.hpp"
#include "network/protocols/lobby_protocol.hpp"
#include "race/history.hpp"
#include "states_screens/race_gui_base.hpp"
#include "utils/constants.hpp"
@@ -398,14 +397,11 @@ core::stringw PlayerController::getName() const
core::stringw name = m_kart->getName();
if (NetworkConfig::get()->isNetworking())
{
auto& players = LobbyProtocol::get<LobbyProtocol>()->getGameSetup()
->getPlayers();
if (auto player = players.at(m_kart->getWorldKartId()).lock())
{
name = player->getName();
if (player->getPerPlayerDifficulty() == PLAYER_DIFFICULTY_HANDICAP)
name = _("%s (handicapped)", name);
}
const RemoteKartInfo& rki = race_manager->getKartInfo(
m_kart->getWorldKartId());
name = rki.getPlayerName();
if (rki.getDifficulty() == PLAYER_DIFFICULTY_HANDICAP)
name = _("%s (handicapped)", name);
}
return name;
} // getName