From 05fd683c64608e88d892f9282f33da6074e56098 Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 16 Oct 2020 03:56:37 -0700 Subject: [PATCH] Fix UNSTABLE_BRANCH checking --- include/types.h | 1 + src/pc/network/discord/discord.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/types.h b/include/types.h index 3207bbdc..5c08c8f2 100644 --- a/include/types.h +++ b/include/types.h @@ -7,6 +7,7 @@ #include #include "macros.h" #include "src/game/characters.h" +#include "pc/network/version.h" // Certain functions are marked as having return values, but do not // actually return a value. This causes undefined behavior, which we'd rather diff --git a/src/pc/network/discord/discord.c b/src/pc/network/discord/discord.c index eef2e76f..c598cd77 100644 --- a/src/pc/network/discord/discord.c +++ b/src/pc/network/discord/discord.c @@ -5,6 +5,7 @@ #include "discord_network.h" #include "pc/debuglog.h" #include "menu/custom_menu_system.h" +#include "pc/network/version.h" #if defined(_WIN32) || defined(_WIN64) #include @@ -128,6 +129,14 @@ static bool ns_discord_initialize(enum NetworkType networkType) { #ifdef DEBUG set_instance_env_variable(); #endif + +#ifdef UNSTABLE_BRANCH + if (networkType != NT_NONE) { + // refuse to host on discord for unstable branch + exit(1); + } +#endif + if (!gDiscordInitialized) { // set up discord params struct DiscordCreateParams params; @@ -142,10 +151,6 @@ static bool ns_discord_initialize(enum NetworkType networkType) { int rc = DiscordCreate(DISCORD_VERSION, ¶ms, &app.core); gDiscordFailed = false; if (networkType != NT_NONE) { -#ifdef UNSTABLE_BRANCH - // refuse to host on discord for unstable branch - exit(1); -#endif DISCORD_REQUIRE(rc); } else if (rc) { LOG_ERROR("DiscordCreate failed: %d", rc);