From e569f3daadff609c53f2428df5c19a5e287e9c52 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 16 Feb 2023 14:39:45 +0700 Subject: [PATCH] fix -dogs default value, add error message (#909) * fix -dogs default value, add error message * don't throw an error if `default_dogs` are set --- src/g_game.c | 5 ++++- src/m_argv.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 6eb51340..e84e61be 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2802,7 +2802,7 @@ static int G_GetHelpers(void) // j = M_CheckParm ("-dogs"); - return j ? j+1 < myargc ? M_ParmArgToInt(j) : 1 : default_dogs; + return j ? (j+1 < myargc && myargv[j+1][0] != '-') ? M_ParmArgToInt(j) : 1 : default_dogs; } // [FG] support named complevels on the command line, e.g. "-complevel boom", @@ -3113,6 +3113,9 @@ void G_ReloadDefaults(boolean keep_demover) if (beta_emulation && demo_version != 203) I_Error("G_ReloadDefaults: Beta emulation requires complevel MBF."); + if ((M_CheckParm("-dog") || M_CheckParm("-dogs")) && demo_version < 203) + I_Error("G_ReloadDefaults: Helper dogs require complevel MBF or MBF21."); + if (demo_version < 203) { monster_infighting = 1; diff --git a/src/m_argv.c b/src/m_argv.c index 387ef977..0eecdb60 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -204,6 +204,11 @@ void M_CheckCommandLine(void) { ++p; } + // -dogs has default value + else if (!strcasecmp(myargv[p], "-dogs")) + { + ++p; + } // -statdump and -dehout allow "-" parameter else if ((!strcasecmp(myargv[p], "-statdump") || !strcasecmp(myargv[p], "-dehout")) &&