]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
change framegroups parsing so the final EOL is optional
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Nov 2011 19:43:34 +0000 (19:43 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 6 Nov 2011 19:43:57 +0000 (20:43 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11532 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=97029c3c0c7950fe45b337e071930fd1d1c42598

model_shared.c

index 3188e60793c99b9de74662256106f5cffdc48aff..e7126be4bd7aa5e0a11e014e8662d42abc093319 100644 (file)
@@ -247,21 +247,21 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
 
        bufptr = buf;
        i = 0;
-       for(;;)
+       while(bufptr)
        {
                // an anim scene!
 
                // REQUIRED: fetch start
-               if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                       break;
+               COM_ParseToken_Simple(&bufptr, true, false, true);
+               if (!bufptr)
+                       break; // end of file
                if (!strcmp(com_token, "\n"))
                        continue; // empty line
                start = atoi(com_token);
 
                // REQUIRED: fetch length
-               if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                       break;
-               if (!strcmp(com_token, "\n"))
+               COM_ParseToken_Simple(&bufptr, true, false, true);
+               if (!bufptr || !strcmp(com_token, "\n"))
                {
                        Con_Printf("framegroups file: missing number of frames\n");
                        continue;
@@ -269,47 +269,35 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
                len = atoi(com_token);
 
                // OPTIONAL args start
-               if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                       break;
+               COM_ParseToken_Simple(&bufptr, true, false, true);
 
                // OPTIONAL: fetch fps
                fps = 20;
-               if (strcmp(com_token, "\n"))
+               if (bufptr && strcmp(com_token, "\n"))
                {
                        fps = atof(com_token);
-                       if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                               break;
+                       COM_ParseToken_Simple(&bufptr, true, false, true);
                }
 
                // OPTIONAL: fetch loopflag
                loop = true;
-               if (strcmp(com_token, "\n"))
+               if (bufptr && strcmp(com_token, "\n"))
                {
                        loop = (atoi(com_token) != 0);
-                       if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                               break;
+                       COM_ParseToken_Simple(&bufptr, true, false, true);
                }
 
                // OPTIONAL: fetch name
                name[0] = 0;
-               if (strcmp(com_token, "\n"))
+               if (bufptr && strcmp(com_token, "\n"))
                {
                        strlcpy(name, com_token, sizeof(name));
-                       if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                               break;
+                       COM_ParseToken_Simple(&bufptr, true, false, true);
                }
 
                // OPTIONAL: remaining unsupported tokens (eat them)
-               while (strcmp(com_token, "\n"))
-               {
-                       if (!COM_ParseToken_Simple(&bufptr, true, false, true))
-                       {
-                               bufptr = NULL;
-                               break;
-                       }
-               }
-               if(!bufptr)
-                       break;
+               while (bufptr && strcmp(com_token, "\n"))
+                       COM_ParseToken_Simple(&bufptr, true, false, true);
 
                //Con_Printf("data: %d %d %d %f %d (%s)\n", i, start, len, fps, loop, name);