mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove format string in server name from Discord rich presence (#18159)
This commit is contained in:
parent
ec12892dba
commit
5cb9b8be15
|
@ -8,7 +8,6 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#ifdef __ENABLE_DISCORD__
|
||||
|
||||
# include "DiscordService.h"
|
||||
|
||||
# include "../Context.h"
|
||||
|
@ -16,6 +15,7 @@
|
|||
# include "../OpenRCT2.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../localisation/Formatting.h"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../world/Park.h"
|
||||
# include "network.h"
|
||||
|
@ -99,7 +99,23 @@ void DiscordService::RefreshPresence() const
|
|||
}
|
||||
else
|
||||
{
|
||||
state = String::ToStd(network_get_server_name());
|
||||
OpenRCT2::FmtString fmtServerName(network_get_server_name());
|
||||
std::string serverName;
|
||||
for (const auto& token : fmtServerName)
|
||||
{
|
||||
if (token.IsLiteral())
|
||||
{
|
||||
serverName += token.text;
|
||||
}
|
||||
else if (token.IsCodepoint())
|
||||
{
|
||||
auto codepoint = token.GetCodepoint();
|
||||
char buffer[8]{};
|
||||
utf8_write_codepoint(buffer, codepoint);
|
||||
serverName += buffer;
|
||||
}
|
||||
}
|
||||
state = serverName;
|
||||
|
||||
// NOTE: the party size is displayed next to state
|
||||
discordPresence.partyId = network_get_server_name();
|
||||
|
|
Loading…
Reference in New Issue