Add billboard text of online player name to non-local player

This commit is contained in:
Benau 2018-04-16 00:13:36 +08:00
parent d30faece9c
commit bd5fc33816

View File

@ -341,11 +341,13 @@ AbstractKart *World::createKart(const std::string &kart_ident, int index,
gk = ReplayPlay::get()->getNumGhostKart(); gk = ReplayPlay::get()->getNumGhostKart();
std::shared_ptr<RenderInfo> ri = std::make_shared<RenderInfo>(); std::shared_ptr<RenderInfo> ri = std::make_shared<RenderInfo>();
if (global_player_id > -1 && race_manager->getKartInfo(global_player_id) core::stringw online_name;
.getDefaultKartColor() > 0.0f) if (global_player_id > -1)
{ {
ri->setHue(race_manager->getKartInfo(global_player_id) ri->setHue(race_manager->getKartInfo(global_player_id)
.getDefaultKartColor()); .getDefaultKartColor());
online_name = race_manager->getKartInfo(global_player_id)
.getPlayerName();
} }
int position = index+1; int position = index+1;
@ -378,6 +380,8 @@ AbstractKart *World::createKart(const std::string &kart_ident, int index,
case RaceManager::KT_NETWORK_PLAYER: case RaceManager::KT_NETWORK_PLAYER:
{ {
controller = new NetworkPlayerController(new_kart); controller = new NetworkPlayerController(new_kart);
if (!online_name.empty())
new_kart->setOnScreenText(online_name.c_str());
m_num_players++; m_num_players++;
break; break;
} }