Skip to content

Commit 65edf1d

Browse files
committed
Missed some macro changes for CUR_MAPFILE_NAME
1 parent 661e99a commit 65edf1d

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

discordrpc.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ static std::string DefaultFooter()
124124

125125
const std::string curPlayerCount = std::to_string(CURPLAYERCOUNT());
126126
const std::string maxPlayerCount = std::to_string(MAX_PLAYERS);
127-
std::string footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" || Current Map: ") + CURMAPFILENAME;
127+
std::string footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" || Current Map: ") + CUR_MAPFILE_NAME;
128128

129129
if (GetBotCount() == 1)
130-
footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" (1 Bot) || Current Map : ") + CURMAPFILENAME;
130+
footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" (1 Bot) || Current Map : ") + CUR_MAPFILE_NAME;
131131
else if (GetBotCount() > 1)
132-
footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" (") + std::to_string(GetBotCount()) + std::string(" Bots) || Current Map : ") + CURMAPFILENAME;
132+
footer = std::string("Players: ") + curPlayerCount + "/" + maxPlayerCount + std::string(" (") + std::to_string(GetBotCount()) + std::string(" Bots) || Current Map : ") + CUR_MAPFILE_NAME;
133133

134134
return footer;
135135
}
@@ -401,13 +401,16 @@ void CDiscordIntegration::ShutdownDiscordRPC()
401401
*/
402402
static void MiscMapRPC(char* details, char* smallImageKey, char* smallImageText)
403403
{
404-
V_strcat(details, CURMAPFILENAME, sizeof(details));
404+
V_strcat(details, CUR_MAPFILE_NAME, sizeof(details));
405405
V_strcat(smallImageKey, "miscmap", sizeof(smallImageKey));
406-
V_strcat(smallImageText, CURMAPFILENAME, sizeof(smallImageText));
406+
V_strcat(smallImageText, CUR_MAPFILE_NAME, sizeof(smallImageText));
407407
}
408408

409409
void CDiscordIntegration::UpdateDiscordRPC()
410410
{
411+
if (!p2mm_discord_rpc.GetBool())
412+
return;
413+
411414
// Get states of the game so we can determine what it is currently doing.
412415
const bool bActiveGame = IsGameActive();
413416
const bool bGameShutdown = IsGameShutdown();
@@ -465,7 +468,7 @@ void CDiscordIntegration::UpdateDiscordRPC()
465468
switch (g_P2MMServerPlugin.m_iCurGameIndex)
466469
{
467470
case (PORTAL_2):
468-
if (std::strstr(CURMAPFILENAME, "sp_"))
471+
if (std::strstr(CUR_MAPFILE_NAME, "sp_"))
469472
{
470473
map = InP2CampaignMap();
471474
if (!map)
@@ -478,7 +481,7 @@ void CDiscordIntegration::UpdateDiscordRPC()
478481
V_snprintf(smallImageKey, 32, "p2spchapter%i", map->chapter);
479482
V_strcat(smallImageText, map->chapterName, sizeof(smallImageText));
480483
}
481-
else if (std::strstr(CURMAPFILENAME, "gelocity"))
484+
else if (std::strstr(CUR_MAPFILE_NAME, "gelocity"))
482485
{
483486
map = InGelocityMap();
484487
if (!map)
@@ -491,11 +494,11 @@ void CDiscordIntegration::UpdateDiscordRPC()
491494
V_strcat(smallImageKey, "race", sizeof(smallImageKey));
492495
V_strcat(smallImageText, map->mapName, sizeof(smallImageText));
493496
}
494-
else if (std::strstr(CURMAPFILENAME, "workshop/"))
497+
else if (std::strstr(CUR_MAPFILE_NAME, "workshop/"))
495498
{
496499
V_strcat(smallImageKey, "workshop", sizeof(smallImageKey));
497500
V_strcat(smallImageText, "Workshop Map", sizeof(smallImageText));
498-
const char* lastForwardSlash = std::strrchr(CURMAPFILENAME, '/');
501+
const char* lastForwardSlash = std::strrchr(CUR_MAPFILE_NAME, '/');
499502
if (!lastForwardSlash)
500503
{
501504
V_strcpy(details, "Playing A Workshop Map");
@@ -518,9 +521,9 @@ void CDiscordIntegration::UpdateDiscordRPC()
518521
}
519522
break;
520523
case (PORTAL_STORIES_MEL):
521-
if (FStrEq(CURMAPFILENAME, "mp_coop_community_hub")) break;
524+
if (FStrEq(CUR_MAPFILE_NAME, "mp_coop_community_hub")) break;
522525

523-
if (std::strstr(CURMAPFILENAME, "sp_"))
526+
if (std::strstr(CUR_MAPFILE_NAME, "sp_"))
524527
map = InMelCampaignMap(true);
525528
else
526529
map = InMelCampaignMap();
@@ -548,7 +551,7 @@ void CDiscordIntegration::UpdateDiscordRPC()
548551
break;
549552
// case (PORTAL_RELOADED):
550553
// Portal Reloaded support will not happen for some time, this will remain commented out.
551-
// if (std::strstr(CURMAPFILENAME, "sp_"))
554+
// if (std::strstr(CUR_MAPFILE_NAME, "sp_"))
552555
// *map = *InReloadedCampaignMap(true);
553556
// else
554557
// *map = *InReloadedCampaignMap();
@@ -559,7 +562,7 @@ void CDiscordIntegration::UpdateDiscordRPC()
559562
// V_strcat(smallImageText, map->chapterName, sizeof(smallImageText));
560563
// break;
561564
case (DIVINITY):
562-
if (std::strstr(CURMAPFILENAME, "adv"))
565+
if (std::strstr(CUR_MAPFILE_NAME, "adv"))
563566
map = InDivinityCampaignMap(true);
564567
else
565568
map = InDivinityCampaignMap();

0 commit comments

Comments
 (0)