[nexuiz-commits] r7172 - in trunk/data: . qcsrc/common
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Jul 9 13:28:13 EDT 2009
Author: div0
Date: 2009-07-09 13:28:13 -0400 (Thu, 09 Jul 2009)
New Revision: 7172
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/common/mapinfo.qc
Log:
ACLs
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-07-09 16:32:49 UTC (rev 7171)
+++ trunk/data/defaultNexuiz.cfg 2009-07-09 17:28:13 UTC (rev 7172)
@@ -1604,5 +1604,4 @@
set sv_loddistance2 4096
seta cl_playerdetailreduction 0 "the higher, the less detailed player models are displayed (LOD)"
-set g_mapinfo_settemp_allow "" "when set, only cvars mentioned here may be changed by mapinfo files"
-set g_mapinfo_settemp_deny "" "when set, cvars mentioned here may not be changed by mapinfo files"
+set g_mapinfo_settemp_acl "+*" "ACL for mapinfo setting cvars"
Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc 2009-07-09 16:32:49 UTC (rev 7171)
+++ trunk/data/qcsrc/common/mapinfo.qc 2009-07-09 17:28:13 UTC (rev 7172)
@@ -29,7 +29,38 @@
return string_null;
return substring(s, o + 1, strlen(s) - (o + 1));
}
+float matchacl(string acl, string str)
+{
+ string t, s;
+ float r, d;
+ r = 0;
+ while(acl)
+ {
+ t = car(acl); acl = cdr(acl);
+ d = 1;
+ if(substring(t, 0, 1) == "-")
+ {
+ d = -1;
+ t = substring(t, 1, strlen(t) - 1);
+ }
+ else if(substring(t, 0, 1) == "+")
+ t = substring(t, 1, strlen(t) - 1);
+ if(substring(t, -1, 1) == "*")
+ {
+ t = substring(t, 0, strlen(t) - 1);
+ s = substring(s, 0, strlen(t));
+ }
+ else
+ s = str;
+ if(s == t)
+ {
+ r = d;
+ }
+ }
+ return r;
+}
+
float _MapInfo_Cache_Active;
float _MapInfo_Cache_DB_NameToIndex;
float _MapInfo_Cache_Buf_IndexToMapData;
@@ -493,10 +524,9 @@
string s, t;
float fh, fh2;
float r, f, n, i;
- string allow, deny;
+ string acl;
- allow = cvar_string("g_mapinfo_settemp_allow");
- deny = cvar_string("g_mapinfo_settemp_deny");
+ acl = cvar_string("g_mapinfo_settemp_acl");
if(strstrofs(pFilename, "/", 0) >= 0)
{
@@ -686,10 +716,8 @@
print("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
else if(substring(t, 0, 10) == "g_mapinfo_")
print("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
- else if(allow != "" && strstrofs(strcat(" ", allow, " "), strcat(" ", t, " "), 0) < 0)
+ else if(matchacl(acl, t) <= 0)
print("Map ", pFilename, " contains a denied setting, ignored\n");
- else if(deny != "" && strstrofs(strcat(" ", deny, " "), strcat(" ", t, " "), 0) >= 0)
- print("Map ", pFilename, " contains a denied setting, ignored\n");
else
{
dprint("Applying temporary setting ", t, " := ", s, "\n");
More information about the nexuiz-commits
mailing list