Make sure g_campaign is always reset to 0 on disconnection (without relying on the...
authorterencehill <piuntn@gmail.com>
Tue, 7 Jan 2020 18:57:51 +0000 (19:57 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 7 Jan 2020 18:57:51 +0000 (19:57 +0100)
qcsrc/server/campaign.qc

index 6fdb6d33986a3afecfe0259e2c272b8d95a16304..5c26da9ed4c7e558c865a93d61368be3c3689723 100644 (file)
@@ -129,6 +129,9 @@ void CampaignPreInit()
        cvar_set("skill", ftos(baseskill));
        cvar_set("bot_number", ftos(campaign_bots[0]));
 #else
        cvar_set("skill", ftos(baseskill));
        cvar_set("bot_number", ftos(campaign_bots[0]));
 #else
+       // since g_campaign is already set to 1 by the menu when starting a campaign level, we first need
+       // to set it back to 0 before settemping it to 1 so it'll be correctly restored to 0 on disconnection
+       cvar_set("g_campaign", "0");
        cvar_settemp("g_campaign", "1");
        cvar_settemp("g_dm", "0");
        cvar_settemp("skill", ftos(baseskill));
        cvar_settemp("g_campaign", "1");
        cvar_settemp("g_dm", "0");
        cvar_settemp("skill", ftos(baseskill));