From 585cb1cfe3201ef64bbe8f330f10111491e9a94c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 23 Aug 2020 07:15:33 -0400 Subject: [PATCH] Finish DEVELOP mode functionality --- src/discord.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/discord.c b/src/discord.c index e69b3abf..236c801b 100644 --- a/src/discord.c +++ b/src/discord.c @@ -473,6 +473,21 @@ static const char *DRPC_GetServerIP(void) return NULL; // Could not get your IP for whatever reason, so we cannot do Discord invites } +/*-------------------------------------------------- + void DRPC_EmptyRequests(void) + + Empties the request list. Any existing requests + will get an ignore reply. +--------------------------------------------------*/ +static void DRPC_EmptyRequests(void) +{ + while (discordRequestList != NULL) + { + Discord_Respond(discordRequestList->userID, DISCORD_REPLY_IGNORE); + DRPC_RemoveRequest(discordRequestList); + } +} + /*-------------------------------------------------- void DRPC_UpdatePresence(void) @@ -497,21 +512,21 @@ void DRPC_UpdatePresence(void) { // User doesn't want to show their game information, so update with empty presence. // This just shows that they're playing SRB2Kart. (If that's too much, then they should disable game activity :V) + DRPC_EmptyRequests(); Discord_UpdatePresence(&discordPresence); return; } -/* #ifdef DEVELOP // This way, we can use the invite feature in-dev, but not have snoopers seeing any potential secrets! :P discordPresence.largeImageKey = "miscdevelop"; discordPresence.largeImageText = "No peeking!"; discordPresence.state = "Testing the game"; + DRPC_EmptyRequests(); Discord_UpdatePresence(&discordPresence); return; #endif // DEVELOP -*/ // Server info if (netgame) @@ -710,11 +725,7 @@ void DRPC_UpdatePresence(void) if (joinSecretSet == false) { // Not able to join? Flush the request list, if it exists. - while (discordRequestList != NULL) - { - Discord_Respond(discordRequestList->userID, DISCORD_REPLY_IGNORE); - DRPC_RemoveRequest(discordRequestList); - } + DRPC_EmptyRequests(); } Discord_UpdatePresence(&discordPresence);