]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
changed COM_ParseToken_Simple to have a parsebackslash option, usually
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 24 Sep 2007 18:45:51 +0000 (18:45 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 24 Sep 2007 18:45:51 +0000 (18:45 +0000)
false, this fixes the problem with broken wad names in hlbsp

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7582 d7cf8633-e32d-0410-b094-e92efae38249

13 files changed:
cl_parse.c
cl_particles.c
common.c
common.h
console.c
host_cmd.c
libcurl.c
menu.c
model_brush.c
prvm_cmds.c
prvm_edict.c
r_shadow.c
sv_main.c

index e0c102e5762454b93cd3d34144fd432e96b62942..cb933480938d1623911492212703f7cfedd7d5bc 100644 (file)
@@ -336,13 +336,13 @@ void CL_ParseEntityLump(char *entdata)
        data = entdata;
        if (!data)
                return;
-       if (!COM_ParseToken_Simple(&data, false))
+       if (!COM_ParseToken_Simple(&data, false, false))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -352,7 +352,7 @@ void CL_ParseEntityLump(char *entdata)
                        strlcpy (key, com_token, sizeof (key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        return; // error
                strlcpy (value, com_token, sizeof (value));
                if (!strcmp("sky", key))
index ad30b92e884ee7130752e91394fc7b6699fae9ff..0a24cf75aacf7fc667eac81fda9e4e30a93d3457 100644 (file)
@@ -209,7 +209,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                        argv[arrayindex][0] = 0;
                for (;;)
                {
-                       if (!COM_ParseToken_Simple(&text, true))
+                       if (!COM_ParseToken_Simple(&text, true, false))
                                return;
                        if (!strcmp(com_token, "\n"))
                                break;
index e0154eec0f759a7c6974aa883e64667c0f05fb6a..6c59c33ca845d18d8283ca2d4cac7fcdcca08be0 100644 (file)
--- a/common.c
+++ b/common.c
@@ -670,7 +670,7 @@ COM_ParseToken_Simple
 Parse a token out of a string
 ==============
 */
-int COM_ParseToken_Simple(const char **datapointer, int returnnewline)
+int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash)
 {
        int len;
        int c;
@@ -730,7 +730,7 @@ skipwhite:
                for (data++;*data && *data != '\"';data++)
                {
                        c = *data;
-                       if (*data == '\\')
+                       if (*data == '\\' && parsebackslash)
                        {
                                data++;
                                c = *data;
@@ -783,7 +783,7 @@ COM_ParseToken_QuakeC
 Parse a token out of a string
 ==============
 */
-int COM_ParseToken_QuakeC(const char **datapointer, int returnnewline)
+int COM_ParseToken_QuakeC(const char **datapointer, qboolean returnnewline)
 {
        int len;
        int c;
@@ -897,7 +897,7 @@ COM_ParseToken_VM_Tokenize
 Parse a token out of a string
 ==============
 */
-int COM_ParseToken_VM_Tokenize(const char **datapointer, int returnnewline)
+int COM_ParseToken_VM_Tokenize(const char **datapointer, qboolean returnnewline)
 {
        int len;
        int c;
index 47f62bb9cf52b678c2355d9c01f9c3befd24b290..0eaa2e25c36155cb3fdfb5587ee1b9acb70a3f85 100644 (file)
--- a/common.h
+++ b/common.h
@@ -202,9 +202,9 @@ float MSG_ReadAngle (protocolversion_t protocol);
 
 extern char com_token[MAX_INPUTLINE];
 
-int COM_ParseToken_Simple(const char **datapointer, int returnnewline);
-int COM_ParseToken_QuakeC(const char **datapointer, int returnnewline);
-int COM_ParseToken_VM_Tokenize(const char **datapointer, int returnnewline);
+int COM_ParseToken_Simple(const char **datapointer, qboolean returnnewline, qboolean parsebackslash);
+int COM_ParseToken_QuakeC(const char **datapointer, qboolean returnnewline);
+int COM_ParseToken_VM_Tokenize(const char **datapointer, qboolean returnnewline);
 int COM_ParseToken_Console(const char **datapointer);
 
 extern int com_argc;
index d7e614a120c221380fd737cc8f314a9cfd2501f8..4c99296243d4f6920ea23804d64b8dac44207035 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1282,7 +1282,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                for (;;)
                                {
                                        int l;
-                                       if (!COM_ParseToken_Simple(&data, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false))
                                                break;
                                        if (com_token[0] == '{')
                                                continue;
@@ -1293,7 +1293,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                        for (l = 0;l < (int)sizeof(keyname) - 1 && com_token[k+l] && com_token[k+l] > ' ';l++)
                                                keyname[l] = com_token[k+l];
                                        keyname[l] = 0;
-                                       if (!COM_ParseToken_Simple(&data, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false))
                                                break;
                                        if (developer.integer >= 100)
                                                Con_Printf("key: %s %s\n", keyname, com_token);
index dbd917dc66b7909b64caa62b4bb8c1b96ba1a89c..21c8690ab492e94af922be38f158dbb85dd6dd04 100644 (file)
@@ -569,7 +569,7 @@ void Host_Loadgame_f (void)
        }
 
        // version
-       COM_ParseToken_Simple(&t, false);
+       COM_ParseToken_Simple(&t, false, false);
        version = atoi(com_token);
        if (version != SAVEGAME_VERSION)
        {
@@ -579,25 +579,25 @@ void Host_Loadgame_f (void)
        }
 
        // description
-       COM_ParseToken_Simple(&t, false);
+       COM_ParseToken_Simple(&t, false, false);
 
        for (i = 0;i < NUM_SPAWN_PARMS;i++)
        {
-               COM_ParseToken_Simple(&t, false);
+               COM_ParseToken_Simple(&t, false, false);
                spawn_parms[i] = atof(com_token);
        }
        // skill
-       COM_ParseToken_Simple(&t, false);
+       COM_ParseToken_Simple(&t, false, false);
 // this silliness is so we can load 1.06 save files, which have float skill values
        current_skill = (int)(atof(com_token) + 0.5);
        Cvar_SetValue ("skill", (float)current_skill);
 
        // mapname
-       COM_ParseToken_Simple(&t, false);
+       COM_ParseToken_Simple(&t, false, false);
        strlcpy (mapname, com_token, sizeof(mapname));
 
        // time
-       COM_ParseToken_Simple(&t, false);
+       COM_ParseToken_Simple(&t, false, false);
        time = atof(com_token);
 
        allowcheats = sv_cheats.integer != 0;
@@ -618,7 +618,7 @@ void Host_Loadgame_f (void)
        {
                // light style
                oldt = t;
-               COM_ParseToken_Simple(&t, false);
+               COM_ParseToken_Simple(&t, false, false);
                // if this is a 64 lightstyle savegame produced by Quake, stop now
                // we have to check this because darkplaces saves 256 lightstyle savegames
                if (com_token[0] == '{')
@@ -636,7 +636,7 @@ void Host_Loadgame_f (void)
        for(;;)
        {
                oldt = t;
-               COM_ParseToken_Simple(&t, false);
+               COM_ParseToken_Simple(&t, false, false);
                if (com_token[0] == '{')
                {
                        t = oldt;
@@ -651,10 +651,10 @@ void Host_Loadgame_f (void)
        for (;;)
        {
                start = t;
-               while (COM_ParseToken_Simple(&t, false))
+               while (COM_ParseToken_Simple(&t, false, false))
                        if (!strcmp(com_token, "}"))
                                break;
-               if (!COM_ParseToken_Simple(&start, false))
+               if (!COM_ParseToken_Simple(&start, false, false))
                {
                        // end of file
                        break;
@@ -1585,7 +1585,7 @@ void Host_Kick_f (void)
                if (Cmd_Argc() > 2)
                {
                        message = Cmd_Args();
-                       COM_ParseToken_Simple(&message, false);
+                       COM_ParseToken_Simple(&message, false, false);
                        if (byNumber)
                        {
                                message++;                                                      // skip the #
index 301a81b7dc1248e921627f50cb20427405a42b01..843fb74a686b200fa748358427c6bed6982c0a5f 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -1276,7 +1276,7 @@ void Curl_ClearRequirements()
        }
        p = sv_curl_serverpackages.string;
        Con_DPrintf("Require all of: %s\n", p);
-       while(COM_ParseToken_Simple(&p, false))
+       while(COM_ParseToken_Simple(&p, false, false))
        {
                Con_DPrintf("Require: %s\n", com_token);
                Curl_RequireFile(com_token);
diff --git a/menu.c b/menu.c
index 1b0a0b2b2113e19af2aeb6bcdf8c583c8e2ada54..aa2d6e346bc97a7198028990352c7350e53f0684 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -897,10 +897,10 @@ static void M_ScanSaves (void)
                buf[sizeof(buf) - 1] = 0;
                t = buf;
                // version
-               COM_ParseToken_Simple(&t, false);
+               COM_ParseToken_Simple(&t, false, false);
                version = atoi(com_token);
                // description
-               COM_ParseToken_Simple(&t, false);
+               COM_ParseToken_Simple(&t, false, false);
                strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));
 
        // change _ back to space
index 6c776b30935edbdea97a32a629fd419f75da6b2a..ffefe938f2bb74b98ded66e0ba41244c7a0031f6 100644 (file)
@@ -1761,13 +1761,13 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
        int i, j, k;
        if (!data)
                return;
-       if (!COM_ParseToken_Simple(&data, false))
+       if (!COM_ParseToken_Simple(&data, false, false))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -1777,7 +1777,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
                        strlcpy(key, com_token, sizeof(key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        return; // error
                dpsnprintf(value, sizeof(value), "%s", com_token);
                if (!strcmp("wad", key)) // for HalfLife maps
@@ -2716,12 +2716,12 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
        if (!maptext)
                return;
        text = maptext;
-       if (!COM_ParseToken_Simple(&data, false))
+       if (!COM_ParseToken_Simple(&data, false, false))
                return; // error
        submodel = 0;
        for (;;)
        {
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        break;
                if (com_token[0] != '{')
                        return; // error
@@ -2732,7 +2732,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                brushes = Mem_Alloc(loadmodel->mempool, maxbrushes * sizeof(mbrush_t));
                for (;;)
                {
-                       if (!COM_ParseToken_Simple(&data, false))
+                       if (!COM_ParseToken_Simple(&data, false, false))
                                return; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -2756,7 +2756,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                }
                                for (;;)
                                {
-                                       if (!COM_ParseToken_Simple(&data, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false))
                                                return; // error
                                        if (com_token[0] == '}')
                                                break; // end of brush
@@ -2765,25 +2765,25 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                        // FIXME: support hl .map format
                                        for (pointnum = 0;pointnum < 3;pointnum++)
                                        {
-                                               COM_ParseToken_Simple(&data, false);
+                                               COM_ParseToken_Simple(&data, false, false);
                                                for (componentnum = 0;componentnum < 3;componentnum++)
                                                {
-                                                       COM_ParseToken_Simple(&data, false);
+                                                       COM_ParseToken_Simple(&data, false, false);
                                                        point[pointnum][componentnum] = atof(com_token);
                                                }
-                                               COM_ParseToken_Simple(&data, false);
+                                               COM_ParseToken_Simple(&data, false, false);
                                        }
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        strlcpy(facetexture, com_token, sizeof(facetexture));
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        //scroll_s = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        //scroll_t = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        //rotate = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        //scale_s = atof(com_token);
-                                       COM_ParseToken_Simple(&data, false);
+                                       COM_ParseToken_Simple(&data, false, false);
                                        //scale_t = atof(com_token);
                                        TriangleNormal(point[0], point[1], point[2], planenormal);
                                        VectorNormalizeDouble(planenormal);
@@ -4135,11 +4135,11 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
        memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
        data = loadmodel->brush.entities;
        // some Q3 maps override the lightgrid_cellsize with a worldspawn key
-       if (data && COM_ParseToken_Simple(&data, false) && com_token[0] == '{')
+       if (data && COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{')
        {
                while (1)
                {
-                       if (!COM_ParseToken_Simple(&data, false))
+                       if (!COM_ParseToken_Simple(&data, false, false))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of worldspawn
@@ -4149,7 +4149,7 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseToken_Simple(&data, false))
+                       if (!COM_ParseToken_Simple(&data, false, false))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
                        if (!strcmp("gridsize", key))
index 7710cf786f340a7809a3055d7b289854276079c0..f2e1720d6ba00b0fcfaa6dc2c4021ba9e79ea9ef 100644 (file)
@@ -2214,7 +2214,7 @@ void VM_parseentitydata(void)
        data = PRVM_G_STRING(OFS_PARM1);
 
        // parse the opening brace
-       if (!COM_ParseToken_Simple(&data, false) || com_token[0] != '{' )
+       if (!COM_ParseToken_Simple(&data, false, false) || com_token[0] != '{' )
                PRVM_ERROR ("VM_parseentitydata: %s: Couldn't parse entity data:\n%s", PRVM_NAME, data );
 
        PRVM_ED_ParseEdict (data, ent);
index 4d4be14b0027ac045ef741b2c07d15e3f150d7fb..fd6b1d0318faa4fddbb818925f897dd6a63bc2e9 100644 (file)
@@ -872,7 +872,7 @@ void PRVM_ED_ParseGlobals (const char *data)
        while (1)
        {
                // parse key
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
                if (com_token[0] == '}')
                        break;
@@ -880,7 +880,7 @@ void PRVM_ED_ParseGlobals (const char *data)
                strlcpy (keyname, com_token, sizeof(keyname));
 
                // parse value
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, true))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
 
                if (com_token[0] == '}')
@@ -1129,7 +1129,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
        while (1)
        {
        // parse key
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf("Key: \"%s\"", com_token);
@@ -1161,7 +1161,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
                }
 
        // parse value
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, true))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf(" \"%s\"\n", com_token);
@@ -1236,7 +1236,7 @@ void PRVM_ED_LoadFromFile (const char *data)
        while (1)
        {
 // parse the opening brace
-               if (!COM_ParseToken_Simple(&data, false))
+               if (!COM_ParseToken_Simple(&data, false, false))
                        break;
                if (com_token[0] != '{')
                        PRVM_ERROR ("PRVM_ED_LoadFromFile: %s: found %s when expecting {", PRVM_NAME, com_token);
index 1ea3a7c3907dad8b6eaf647afc18f109d744f9b8..f5df7b452ab5500a1c628ccaf344ca7bdacb35d0 100644 (file)
@@ -3614,7 +3614,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                data = r_refdef.worldmodel->brush.entities;
        if (!data)
                return;
-       for (entnum = 0;COM_ParseToken_Simple(&data, false) && com_token[0] == '{';entnum++)
+       for (entnum = 0;COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{';entnum++)
        {
                type = LIGHTTYPE_MINUSX;
                origin[0] = origin[1] = origin[2] = 0;
@@ -3632,7 +3632,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                islight = false;
                while (1)
                {
-                       if (!COM_ParseToken_Simple(&data, false))
+                       if (!COM_ParseToken_Simple(&data, false, false))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -3642,7 +3642,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseToken_Simple(&data, false))
+                       if (!COM_ParseToken_Simple(&data, false, false))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
 
index 753c96ee5023c7a2b92413b051b6e3bb71a8362b..7b56c8fc887c2ab2155935857d3a56f633d7cd9b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2203,7 +2203,7 @@ int SV_ParticleEffectIndex(const char *name)
                                argc = 0;
                                for (;;)
                                {
-                                       if (!COM_ParseToken_Simple(&text, true) || !strcmp(com_token, "\n"))
+                                       if (!COM_ParseToken_Simple(&text, true, false) || !strcmp(com_token, "\n"))
                                                break;
                                        if (argc < 16)
                                        {