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)))
}
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;
return 1;
}
+
+vector vec2(vector v)
+{
+ v_z = 0;
+ return v;
+}
+
+#ifndef MENUQC
+vector NearestPointOnBox(entity box, vector org)
+{
+ vector m1, m2, nearest;
+
+ m1 = box.mins + box.origin;
+ m2 = box.maxs + box.origin;
+
+ nearest_x = bound(m1_x, org_x, m2_x);
+ nearest_y = bound(m1_y, org_y, m2_y);
+ nearest_z = bound(m1_z, org_z, m2_z);
+
+ return nearest;
+}
+#endif