From b0ea8cfac9138fa7868067c3146069ba01ed1a2d Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 25 Jun 2023 17:32:20 +0300 Subject: [PATCH] Add addfilelocal command --- src/d_netcmd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 36919e62c..343c0f15f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -138,6 +138,7 @@ static void Command_ResetCamera_f(void); static void Command_View_f (void); static void Command_SetViews_f(void); +static void Command_Addfilelocal(void); static void Command_Addfile(void); static void Command_ListWADS_f(void); #ifdef DELFILE @@ -613,6 +614,7 @@ void D_RegisterServerCommands(void) COM_AddCommand("showmap", Command_Showmap_f); COM_AddCommand("mapmd5", Command_Mapmd5_f); + COM_AddCommand("addfilelocal", Command_Addfilelocal); COM_AddCommand("addfile", Command_Addfile); COM_AddCommand("listwad", Command_ListWADS_f); @@ -4378,6 +4380,29 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) G_SetGameModified(true, false); } +static void Command_Addfilelocal(void) +{ + const char *fn; + INT32 i; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("addfile : load wad file\n")); + return; + } + else + fn = COM_Argv(1); + + // Disallow non-printing characters and semicolons. + for (i = 0; fn[i] != '\0'; i++) + if (!isprint(fn[i]) || fn[i] == ';') + return; + + // Add file on your client directly if it is trivial, or you aren't in a netgame. + P_AddWadFile(fn); +} + + /** Adds a pwad at runtime. * Searches for sounds, maps, music, new images. */