]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cleanups in unquote function
authorAmadeusz Sławiński <amade@asmblr.net>
Wed, 22 Feb 2017 12:54:25 +0000 (13:54 +0100)
committerAmadeusz Sławiński <amade@asmblr.net>
Wed, 22 Feb 2017 12:54:25 +0000 (13:54 +0100)
reduce scope of variables, use && instead of double if, and use already set variable
instead of calculatin anew

qcsrc/common/mapinfo.qc

index 92ed2b9f112d9527936c6339cec6c81c9434d675..752a99f1f1c610d606e58af29035dac427949f61 100644 (file)
@@ -231,16 +231,13 @@ string MapInfo_BSPName_ByID(float i)
 
 string unquote(string s)
 {
-       float i, j, l;
-       l = strlen(s);
-       j = -1;
-       for(i = 0; i < l; ++i)
+       float l = strlen(s);
+       for(float i = 0; i < l; ++i)
        {
-               string ch;
-               ch = substring(s, i, 1);
-               if(ch != " ") if(ch != "\"")
+               string ch = substring(s, i, 1);
+               if((ch != " ") && (ch != "\""))
                {
-                       for(j = strlen(s) - i - 1; j > 0; --j)
+                       for(float j = l - i - 1; j > 0; --j)
                        {
                                ch = substring(s, i+j, 1);
                                if(ch != " ") if(ch != "\"")