Chunk file names now store complete coordinate set, eliminating collisions

This commit is contained in:
Sasha Koshka
2022-05-02 10:55:56 -04:00
parent 74aa6a1905
commit b61fcbd3cc

View File

@@ -40,6 +40,11 @@ int World_save (World *world) {
}
}
char metadataPath[PATH_MAX];
data_getWorldMetaPath(metadataPath, world->path);
// FILE *metadata = fopen()
return 0;
}
@@ -102,9 +107,9 @@ u_int32_t chunkHash (int x, int y, int z) {
static void chunkFilePath (World *world, char *path, int x, int y, int z) {
snprintf (
path, PATH_MAX,
"%s/%08x.ch",
"%s/%08x-%08x-%08x.ch",
world->path,
chunkHash(x / 64, y / 64, z / 64));
x >> 6, y >> 6, z >> 6);
}
/* chunkLookup