filename filtering for media files

No more spaces in filenames. The only allowed chars are a-z, A-Z, 0-9 and
"-_.()".

An exception are texture filenames, which may also have a prefix command
like "<decal>" included.

Also fixed some memory leaks in media download.
This commit is contained in:
ac-stef
2015-05-18 14:46:03 +02:00
parent e318ecd68e
commit 786a6cdce1
8 changed files with 71 additions and 29 deletions
+13 -9
View File
@@ -111,15 +111,19 @@ const char *mmshortname(const char *name) { return !strncmp(name, mmpath, strlen
void mapmodel(int *rad, int *h, int *zoff, char *snap, char *name)
{
intret(mapmodels.length());
mapmodelinfo &mmi = mapmodels.add();
mmi.rad = *rad;
mmi.h = *h;
mmi.zoff = *zoff;
mmi.m = NULL;
formatstring(mmi.name)("%s%s", mmpath, name);
mapmodelchanged = 1;
flagmapconfigchange();
if(*snap && *name) // ignore "mapmodel" commands with insufficient parameters
{
intret(mapmodels.length());
mapmodelinfo &mmi = mapmodels.add();
mmi.rad = *rad;
mmi.h = *h;
mmi.zoff = *zoff;
mmi.m = NULL;
filtertext(name, name, FTXT__MEDIAFILEPATH);
formatstring(mmi.name)("%s%s", mmpath, name);
mapmodelchanged = 1;
flagmapconfigchange();
}
}
COMMAND(mapmodel, "iiiss");