From b61fcbd3cc66bfa2e69679ebc4988b89f22b5efe Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 2 May 2022 10:55:56 -0400 Subject: [PATCH] Chunk file names now store complete coordinate set, eliminating collisions --- src/terrain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/terrain.c b/src/terrain.c index e8e8966..a967908 100644 --- a/src/terrain.c +++ b/src/terrain.c @@ -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