From 509e66b6b32269d890ed0c2c9ec965857cb91f10 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 13 Aug 2023 11:44:35 +0300 Subject: [PATCH] Small hack to prevent map command spam crashing the game --- src/d_netcmd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 3ddeb6b82..33697e97c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2650,14 +2650,27 @@ ConcatCommandArgv (int start, int end) return final; } + +static tic_t last_map_cmd = 0; // // Warp to map code. // Called either from map console command, or idclev cheat. // // Largely rewritten by James. // +// Added small cooldown which prevents from spamming map command and crashing +// game. It is not wery good fix but oh well i can't find yet where are mobj's +// freed/allocated between map loads and why they crash game - Indev +// static void Command_Map_f(void) { + if (I_GetTime() - last_map_cmd < 20) { + CONS_Alert(CONS_WARNING, "Map command is used too frequently!\n"); + return; + } + + last_map_cmd = I_GetTime(); + size_t first_option; size_t option_force; size_t option_gametype;