From 4ff0a8358fe885b25c4319c8d7dd2d32c06bda07 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 25 Feb 2023 13:35:09 -0500 Subject: [PATCH] Rework exitlevel conditions - Uses K_CanChangeRules instead of checking for multiplayer, to catch all of the restricted singleplayer scenarios - Checks for server admin first before cheats --- src/d_netcmd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4da4b6754..40d020700 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5330,14 +5330,22 @@ static void Command_Mapmd5_f(void) static void Command_ExitLevel_f(void) { - if (!(netgame || multiplayer) && !CV_CheatsEnabled()) - CONS_Printf(M_GetText("This only works in a netgame.\n")); - else if (!(server || (IsPlayerAdmin(consoleplayer)))) + if (!(server || (IsPlayerAdmin(consoleplayer)))) + { CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); + } + else if (K_CanChangeRules(false) == false && CV_CheatsEnabled() == false) + { + CONS_Printf(M_GetText("This cannot be used without cheats enabled.\n")); + } else if (( gamestate != GS_LEVEL && gamestate != GS_CREDITS ) || demo.playback) + { CONS_Printf(M_GetText("You must be in a level to use this.\n")); + } else + { SendNetXCmd(XD_EXITLEVEL, NULL, 0); + } } static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)