@@ -120,7 +120,7 @@ static int check_xyz(int x, int y, int z)
120120int path_to_xyz (const char * tilepath , const char * path , char * xmlconfig , int * px , int * py , int * pz )
121121{
122122#ifdef DIRECTORY_HASH
123- int i , n , hash [5 ], x , y , z ;
123+ int i , n , hash [7 ], x , y , z ;
124124
125125 for (i = 0 ; tilepath [i ] && tilepath [i ] == path [i ]; ++ i )
126126 ;
@@ -130,15 +130,15 @@ int path_to_xyz(const char *tilepath, const char *path, char *xmlconfig, int *px
130130 return 1 ;
131131 }
132132
133- n = sscanf (path + i , "/%40[^/]/%d/%d/%d/%d/%d/%d" , xmlconfig , pz , & hash [0 ], & hash [1 ], & hash [2 ], & hash [3 ], & hash [4 ]);
133+ n = sscanf (path + i , "/%40[^/]/%d/%d/%d/%d/%d/%d/%d/%d " , xmlconfig , pz , & hash [0 ], & hash [1 ], & hash [2 ], & hash [3 ], & hash [4 ], & hash [ 5 ], & hash [ 6 ]);
134134
135- if (n != 7 ) {
135+ if (n != 9 ) {
136136 g_logger (G_LOG_LEVEL_ERROR , "Failed to parse tile path: %s" , path );
137137 return 1 ;
138138 } else {
139139 x = y = 0 ;
140140
141- for (i = 0 ; i < 5 ; i ++ ) {
141+ for (i = 0 ; i < 7 ; i ++ ) {
142142 if (hash [i ] < 0 || hash [i ] > 255 ) {
143143 g_logger (G_LOG_LEVEL_ERROR , "Failed to parse tile path (invalid %d): %s" , hash [i ], path );
144144 return 2 ;
@@ -160,7 +160,7 @@ int path_to_xyz(const char *tilepath, const char *path, char *xmlconfig, int *px
160160 int n ;
161161 n = sscanf (path , TILE_PATH "/%40[^/]/%d/%d/%d" , xmlconfig , pz , px , py );
162162
163- if (n != 4 ) {
163+ if (n != 6 ) {
164164 g_logger (G_LOG_LEVEL_ERROR , "Failed to parse tile path: %s" , path );
165165 return 1 ;
166166 } else {
@@ -174,7 +174,7 @@ int path_to_xyz(const char *tilepath, const char *path, char *xmlconfig, int *px
174174// Returns the path to the meta-tile and the offset within the meta-tile
175175int xyzo_to_meta (char * path , size_t len , const char * tile_dir , const char * xmlconfig , const char * options , int x , int y , int z )
176176{
177- unsigned char i , hash [5 ], offset , mask ;
177+ unsigned char i , hash [7 ], offset , mask ;
178178
179179 // Each meta tile winds up in its own file, with several in each leaf directory
180180 // the .meta tile name is beasd on the sub-tile at (0,0)
@@ -183,7 +183,7 @@ int xyzo_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlco
183183 x &= ~mask ;
184184 y &= ~mask ;
185185
186- for (i = 0 ; i < 5 ; i ++ ) {
186+ for (i = 0 ; i < 7 ; i ++ ) {
187187 hash [i ] = ((x & 0x0f ) << 4 ) | (y & 0x0f );
188188 x >>= 4 ;
189189 y >>= 4 ;
@@ -192,9 +192,9 @@ int xyzo_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlco
192192#ifdef DIRECTORY_HASH
193193
194194 if (strlen (options )) {
195- snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u.%s.meta" , tile_dir , xmlconfig , z , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ], options );
195+ snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u/%u/%u .%s.meta" , tile_dir , xmlconfig , z , hash [ 6 ], hash [ 5 ] , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ], options );
196196 } else {
197- snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u.meta" , tile_dir , xmlconfig , z , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ]);
197+ snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u/%u/%u .meta" , tile_dir , xmlconfig , z , hash [ 6 ], hash [ 5 ] , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ]);
198198 }
199199
200200#else // DIRECTORY_HASH
@@ -222,15 +222,15 @@ void xyz_to_path(char *path, size_t len, const char *tile_dir, const char *xmlco
222222 // We attempt to cluster the tiles so that a 16x16 square of tiles will be in a single directory
223223 // Hash stores our 40 bit result of mixing the 20 bits of the x & y co-ordinates
224224 // 4 bits of x & y are used per byte of output
225- unsigned char i , hash [5 ];
225+ unsigned char i , hash [7 ];
226226
227- for (i = 0 ; i < 5 ; i ++ ) {
227+ for (i = 0 ; i < 7 ; i ++ ) {
228228 hash [i ] = ((x & 0x0f ) << 4 ) | (y & 0x0f );
229229 x >>= 4 ;
230230 y >>= 4 ;
231231 }
232232
233- snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u.png" , tile_dir , xmlconfig , z , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ]);
233+ snprintf (path , len , "%s/%s/%d/%u/%u/%u/%u/%u/%u/%u .png" , tile_dir , xmlconfig , z , hash [ 6 ], hash [ 5 ] , hash [4 ], hash [3 ], hash [2 ], hash [1 ], hash [0 ]);
234234#else // DIRECTORY_HASH
235235 snprintf (path , len , TILE_PATH "/%s/%d/%d/%d.png" , xmlconfig , z , x , y );
236236#endif // DIRECTORY_HASH
0 commit comments