From b4500226dd8bb97e7bb7c2e5a10758122322e60c Mon Sep 17 00:00:00 2001 From: Edo Date: Thu, 23 Mar 2023 12:02:43 +0000 Subject: [PATCH] [Discord]: Make sure partyId is at least 2 chars (#871) --- src/Components/Modules/Discord.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Discord.cpp b/src/Components/Modules/Discord.cpp index 12889f5e..9087d734 100644 --- a/src/Components/Modules/Discord.cpp +++ b/src/Components/Modules/Discord.cpp @@ -62,6 +62,8 @@ namespace Components return; } + char hostNameBuffer[256]{}; + const auto* map = Game::UI_GetMapDisplayName((*Game::ui_mapname)->current.string); const Game::StringTable* table; @@ -86,7 +88,6 @@ namespace Components } else { - char hostNameBuffer[256]{}; TextRenderer::StripColors(Party::GetHostName().data(), hostNameBuffer, sizeof(hostNameBuffer)); TextRenderer::StripAllTextIcons(hostNameBuffer, hostNameBuffer, sizeof(hostNameBuffer)); @@ -97,7 +98,7 @@ namespace Components std::hash hashFn; const auto address = Party::Target(); - DiscordPresence.partyId = Utils::String::VA("%zu", hashFn(address) ^ GetDiscordNonce()); + DiscordPresence.partyId = Utils::String::VA("%s - %zu", hostNameBuffer, hashFn(address) ^ GetDiscordNonce()); DiscordPresence.joinSecret = address.getCString(); DiscordPresence.partySize = Game::cgArray[0].snap ? Game::cgArray[0].snap->numClients : 1; DiscordPresence.partyMax = Party::GetMaxClients();