mirror of https://github.com/OpenRCT2/OpenRCT2.git
Migrate server setting getters to u8string
This commit is contained in:
parent
0fa0e16872
commit
24247e9c6b
|
@ -349,8 +349,8 @@ static ScreenCoordsXY WindowMultiplayerInformationGetSize()
|
|||
}
|
||||
|
||||
// Likewise, for the optional server description -- which can be a little longer.
|
||||
const utf8* descString = network_get_server_description();
|
||||
if (!str_is_null_or_empty(descString))
|
||||
const auto& descString = network_get_server_description();
|
||||
if (!descString.empty())
|
||||
{
|
||||
u8string buffer = descString;
|
||||
gfx_wrap_string(buffer.data(), width, FontStyle::Medium, &numLines);
|
||||
|
@ -359,16 +359,16 @@ static ScreenCoordsXY WindowMultiplayerInformationGetSize()
|
|||
|
||||
// Finally, account for provider info, if present.
|
||||
{
|
||||
const utf8* providerName = network_get_server_provider_name();
|
||||
if (!str_is_null_or_empty(providerName))
|
||||
const auto& providerName = network_get_server_provider_name();
|
||||
if (!providerName.empty())
|
||||
height += LIST_ROW_HEIGHT;
|
||||
|
||||
const utf8* providerEmail = network_get_server_provider_email();
|
||||
if (!str_is_null_or_empty(providerEmail))
|
||||
const auto& providerEmail = network_get_server_provider_email();
|
||||
if (!providerEmail.empty())
|
||||
height += LIST_ROW_HEIGHT;
|
||||
|
||||
const utf8* providerWebsite = network_get_server_provider_website();
|
||||
if (!str_is_null_or_empty(providerWebsite))
|
||||
const auto& providerWebsite = network_get_server_provider_website();
|
||||
if (!providerWebsite.empty())
|
||||
height += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
|
@ -409,46 +409,46 @@ static void WindowMultiplayerInformationPaint(rct_window* w, rct_drawpixelinfo*
|
|||
auto screenCoords = ScreenCoordsXY{ 3, 50 };
|
||||
int32_t width = w->width - 6;
|
||||
|
||||
const utf8* name = network_get_server_name();
|
||||
const auto& name = network_get_server_name();
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(name);
|
||||
ft.Add<const char*>(name.c_str());
|
||||
screenCoords.y += DrawTextWrapped(dpi, screenCoords, width, STR_STRING, ft, { w->colours[1] });
|
||||
screenCoords.y += LIST_ROW_HEIGHT / 2;
|
||||
}
|
||||
|
||||
const utf8* description = network_get_server_description();
|
||||
if (!str_is_null_or_empty(description))
|
||||
const auto& description = network_get_server_description();
|
||||
if (!description.empty())
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(description);
|
||||
ft.Add<const char*>(description.c_str());
|
||||
screenCoords.y += DrawTextWrapped(dpi, screenCoords, width, STR_STRING, ft, { w->colours[1] });
|
||||
screenCoords.y += LIST_ROW_HEIGHT / 2;
|
||||
}
|
||||
|
||||
const utf8* providerName = network_get_server_provider_name();
|
||||
if (!str_is_null_or_empty(providerName))
|
||||
const auto& providerName = network_get_server_provider_name();
|
||||
if (!providerName.empty())
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(providerName);
|
||||
ft.Add<const char*>(providerName.c_str());
|
||||
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_NAME, ft);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
const utf8* providerEmail = network_get_server_provider_email();
|
||||
if (!str_is_null_or_empty(providerEmail))
|
||||
const auto& providerEmail = network_get_server_provider_email();
|
||||
if (!providerEmail.empty())
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(providerEmail);
|
||||
ft.Add<const char*>(providerEmail.c_str());
|
||||
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_EMAIL, ft);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
const utf8* providerWebsite = network_get_server_provider_website();
|
||||
if (!str_is_null_or_empty(providerWebsite))
|
||||
const auto& providerWebsite = network_get_server_provider_website();
|
||||
if (!providerWebsite.empty())
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(providerWebsite);
|
||||
ft.Add<const char*>(providerWebsite.c_str());
|
||||
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_WEBSITE, ft);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ void DiscordService::RefreshPresence() const
|
|||
state = serverName;
|
||||
|
||||
// NOTE: the party size is displayed next to state
|
||||
discordPresence.partyId = network_get_server_name();
|
||||
discordPresence.partyId = network_get_server_name().c_str();
|
||||
discordPresence.partySize = network_get_num_players();
|
||||
discordPresence.partyMax = 256;
|
||||
|
||||
|
|
|
@ -3430,8 +3430,8 @@ void network_chat_show_connected_message()
|
|||
// Display server greeting if one exists
|
||||
void network_chat_show_server_greeting()
|
||||
{
|
||||
auto greeting = network_get_server_greeting();
|
||||
if (!str_is_null_or_empty(greeting))
|
||||
const auto& greeting = network_get_server_greeting();
|
||||
if (!greeting.empty())
|
||||
{
|
||||
thread_local std::string greeting_formatted;
|
||||
greeting_formatted.assign("{OUTLINE}{GREEN}");
|
||||
|
@ -3886,35 +3886,35 @@ static u8string network_get_public_key_path(u8string_view playerName, u8string_v
|
|||
return Path::Combine(network_get_keys_directory(), filename);
|
||||
}
|
||||
|
||||
const utf8* network_get_server_name()
|
||||
u8string network_get_server_name()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerName.c_str();
|
||||
return network.ServerName;
|
||||
}
|
||||
const utf8* network_get_server_description()
|
||||
u8string network_get_server_description()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerDescription.c_str();
|
||||
return network.ServerDescription;
|
||||
}
|
||||
const utf8* network_get_server_greeting()
|
||||
u8string network_get_server_greeting()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerGreeting.c_str();
|
||||
return network.ServerGreeting;
|
||||
}
|
||||
const utf8* network_get_server_provider_name()
|
||||
u8string network_get_server_provider_name()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerProviderName.c_str();
|
||||
return network.ServerProviderName;
|
||||
}
|
||||
const utf8* network_get_server_provider_email()
|
||||
u8string network_get_server_provider_email()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerProviderEmail.c_str();
|
||||
return network.ServerProviderEmail;
|
||||
}
|
||||
const utf8* network_get_server_provider_website()
|
||||
u8string network_get_server_provider_website()
|
||||
{
|
||||
auto& network = OpenRCT2::GetContext()->GetNetwork();
|
||||
return network.ServerProviderWebsite.c_str();
|
||||
return network.ServerProviderWebsite;
|
||||
}
|
||||
|
||||
std::string network_get_version()
|
||||
|
@ -4168,29 +4168,29 @@ void network_append_chat_log(std::string_view)
|
|||
void network_append_server_log(const utf8* text)
|
||||
{
|
||||
}
|
||||
const utf8* network_get_server_name()
|
||||
u8string network_get_server_name()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
const utf8* network_get_server_description()
|
||||
u8string network_get_server_description()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
const utf8* network_get_server_greeting()
|
||||
u8string network_get_server_greeting()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
const utf8* network_get_server_provider_name()
|
||||
u8string network_get_server_provider_name()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
const utf8* network_get_server_provider_email()
|
||||
u8string network_get_server_provider_email()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
const utf8* network_get_server_provider_website()
|
||||
u8string network_get_server_provider_website()
|
||||
{
|
||||
return nullptr;
|
||||
return u8string();
|
||||
}
|
||||
std::string network_get_version()
|
||||
{
|
||||
|
|
|
@ -103,12 +103,12 @@ void network_set_password(const char* password);
|
|||
|
||||
void network_append_chat_log(std::string_view text);
|
||||
void network_append_server_log(const utf8* text);
|
||||
[[nodiscard]] const utf8* network_get_server_name();
|
||||
[[nodiscard]] const utf8* network_get_server_description();
|
||||
[[nodiscard]] const utf8* network_get_server_greeting();
|
||||
[[nodiscard]] const utf8* network_get_server_provider_name();
|
||||
[[nodiscard]] const utf8* network_get_server_provider_email();
|
||||
[[nodiscard]] const utf8* network_get_server_provider_website();
|
||||
[[nodiscard]] u8string network_get_server_name();
|
||||
[[nodiscard]] u8string network_get_server_description();
|
||||
[[nodiscard]] u8string network_get_server_greeting();
|
||||
[[nodiscard]] u8string network_get_server_provider_name();
|
||||
[[nodiscard]] u8string network_get_server_provider_email();
|
||||
[[nodiscard]] u8string network_get_server_provider_website();
|
||||
|
||||
[[nodiscard]] std::string network_get_version();
|
||||
|
||||
|
|
Loading…
Reference in New Issue