]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
fix starting the gametype
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 1efc0e3738a06a4d9e5c33cd5681571c0d1b0444..2618d09fd69bca0bf4cea60ddf05918a8c5ccd3f 100644 (file)
@@ -309,7 +309,8 @@ float db_load(string pFilename)
        fh = fopen(pFilename, FILE_READ);
        if(fh < 0)
                return db;
-       if(stof(fgets(fh)) == DB_BUCKETS)
+       l = fgets(fh);
+       if(stof(l) == DB_BUCKETS)
        {
                i = 0;
                while((l = fgets(fh)))
@@ -321,14 +322,18 @@ float db_load(string pFilename)
        }
        else
        {
-               // different count of buckets?
+               // different count of buckets, or a dump?
                // need to reorganize the database then (SLOW)
-               while((l = fgets(fh)))
+               //
+               // note: we also parse the first line (l) in case the DB file is
+               // missing the bucket count
+               do
                {
                        n = tokenizebyseparator(l, "\\");
                        for(j = 2; j < n; j += 2)
                                db_put(db, argv(j-1), uri_unescape(argv(j)));
                }
+               while((l = fgets(fh)));
        }
        fclose(fh);
        return db;
@@ -434,6 +439,7 @@ string GametypeNameFromType(float g)
        else if (g == GAME_RACE) return "rc";
        else if (g == GAME_NEXBALL) return "nexball";
        else if (g == GAME_CTS) return "cts";
+       else if (g == GAME_FREEZETAG) return "freezetag";
        return "dm";
 }