Commit f0bff268 authored by Andrew Price's avatar Andrew Price
Browse files

Don't load mwscript scripts

(Or anything that isn't .mwrc or a .js file)
parent 4b8d96ef
Loading
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -49,14 +49,7 @@ void perms_restore(void)
	}
}

static void warn_of_mwscript_death(const char *filename)
{
	// Slightly obnoxious by design
	printf("*** You are using mwscript scripts: %s\n", filename);
	printf("*** mwscript support will be removed from mw on April 7th 2019.\n");
}

int do_warn_of_mwscript_death = 0;
int mwrc_loaded = 0;
static int ReadInitFile(const char *base, const char *filename)
{
	FILE *file;
@@ -125,12 +118,11 @@ static int ReadInitFile(const char *base, const char *filename)
		return 0; // changed because if an error occured after this point the file exists, the js code has reported the error to the user and returning 1 will report to them that it doesn't exist
	}

	/* Warnings for the initial .mwrc are a little OTT for now but warn on
	   subsequent mwscript loads */
	if (do_warn_of_mwscript_death)
		warn_of_mwscript_death(filename);
	else
		do_warn_of_mwscript_death = 1;
	if (mwrc_loaded) {
		fprintf(stderr, "Warning: file included in .mwrc not supported: %s\n", filename);
		return 0;
	} else
		mwrc_loaded = 1;

	lineno=0;
	while (!feof(file))
+2 −2
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ void t_mwrc(CommandList *cm, int argc, const char **argv, char *args)
	}
}

extern int do_warn_of_mwscript_death;
extern int mwrc_loaded;
void t_restart(CommandList *cm, int argc, const char **argv, char *args)
{
	extern var_list_t	var_list;
@@ -365,7 +365,7 @@ void t_restart(CommandList *cm, int argc, const char **argv, char *args)

	RoomDestroy(&user->room);

	do_warn_of_mwscript_death = 0;
	mwrc_loaded = 0;
	RoomInit(&user->room);
	LoadRoom(&user->room, user->record.room);