Show owner name as Official if official server hoster account is used
This commit is contained in:
parent
f5245a679e
commit
d2bf17e71a
@ -62,15 +62,25 @@ Server::Server(const XMLNode& xml)
|
||||
xml.get("private_port", &m_private_port);
|
||||
xml.get("password", &m_password_protected);
|
||||
xml.get("distance", &m_distance);
|
||||
m_server_owner_name = "-";
|
||||
m_server_owner_name = L"-";
|
||||
|
||||
// Show owner name as Official right now if official server hoster account
|
||||
bool official = false;
|
||||
xml.get("official", &official);
|
||||
if (official)
|
||||
{
|
||||
// I18N: Official means this server is hosted by STK team
|
||||
m_server_owner_name = _("Official");
|
||||
return;
|
||||
}
|
||||
|
||||
// Display server owner name if he's your friend or localhost
|
||||
Online::OnlineProfile* opp = PlayerManager::getCurrentPlayer()->getProfile();
|
||||
Online::OnlineProfile* opp =
|
||||
PlayerManager::getCurrentPlayer()->getProfile();
|
||||
// Check localhost owner
|
||||
if (opp && opp->getID() == m_server_owner)
|
||||
{
|
||||
m_server_owner_name =
|
||||
StringUtils::wideToUtf8(opp->getUserName());
|
||||
m_server_owner_name = opp->getUserName();
|
||||
}
|
||||
else if (opp && opp->hasFetchedFriends())
|
||||
{
|
||||
@ -83,8 +93,7 @@ Server::Server(const XMLNode& xml)
|
||||
Online::ProfileManager::get()->getProfileByID(user_id);
|
||||
if (friend_profile)
|
||||
{
|
||||
m_server_owner_name =
|
||||
StringUtils::wideToUtf8(friend_profile->getUserName());
|
||||
m_server_owner_name = friend_profile->getUserName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
|
||||
/* WAN server only, show the owner name of server, can only be seen
|
||||
* for localhost or if you are friend with the server owner. */
|
||||
std::string m_server_owner_name;
|
||||
core::stringw m_server_owner_name;
|
||||
|
||||
/* WAN server only, distance based on IP latitude and longitude. */
|
||||
float m_distance;
|
||||
@ -119,7 +119,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool isPasswordProtected() const { return m_password_protected; }
|
||||
// ------------------------------------------------------------------------
|
||||
const std::string& getServerOwnerName() const
|
||||
const core::stringw& getServerOwnerName() const
|
||||
{ return m_server_owner_name; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getDistance() const { return m_distance; }
|
||||
|
@ -154,7 +154,7 @@ void ServerSelection::loadList(unsigned sort_case)
|
||||
return c->getServerMode() > d->getServerMode();
|
||||
break;
|
||||
case 4:
|
||||
return c->getServerOwnerName() > d->getServerOwnerName();
|
||||
return !(c->getServerOwnerName() < d->getServerOwnerName());
|
||||
break;
|
||||
case 5:
|
||||
return c->getDistance() > d->getDistance();
|
||||
@ -183,8 +183,8 @@ void ServerSelection::loadList(unsigned sort_case)
|
||||
|
||||
if (NetworkConfig::get()->isWAN())
|
||||
{
|
||||
row.push_back(GUIEngine::ListWidget::ListCell(StringUtils::
|
||||
utf8ToWide(server->getServerOwnerName()), -1, 1, true));
|
||||
row.push_back(GUIEngine::ListWidget::ListCell(
|
||||
server->getServerOwnerName(), -1, 1, true));
|
||||
// I18N: In server selection screen, unknown distance to server
|
||||
core::stringw distance = _("Unknown");
|
||||
if (!(server->getDistance() < 0.0f))
|
||||
|
Loading…
x
Reference in New Issue
Block a user