From: Rudolf Polzer Date: Wed, 27 Oct 2010 09:27:38 +0000 (+0200) Subject: when loading the DB, and it's a dump, also parse the first line (so even if it's... X-Git-Tag: xonotic-v0.1.0preview~246 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a1b5ecc644b77cb42388dd3b0ee3b3dd3747652a;p=xonotic%2Fxonotic-data.pk3dir.git when loading the DB, and it's a dump, also parse the first line (so even if it's missing due to a filter op, the DB still loads) --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 1efc0e373..42be955f0 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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;