Added proper mod function.

This commit is contained in:
2021-04-03 15:28:48 +11:00
parent 93565a9905
commit 9f5fa7722a
4 changed files with 13 additions and 4 deletions

View File

@ -89,9 +89,9 @@ void chunkListShift(chunklist_t *list, int32_t x, int32_t y, int32_t z) {
chunk = list->chunkList[i];
// Calculate the new local positions for the chunk.
nx = (chunk->x - list->x - x) % list->width;
ny = (chunk->y - list->y - y) % list->height;
nz = (chunk->z - list->z - z) % list->depth;
nx = mod(chunk->x - list->x - x, list->width);
ny = mod(chunk->y - list->y - y, list->height);
nz = mod(chunk->z - list->z - z, list->depth);
// Load the chunk if we need to. We also use this to calculate new absolutes
if(

View File

@ -7,6 +7,7 @@
#include <stdint.h>
#include <malloc.h>
#include "chunk.h"
#include "./../util/math.h"
#define CHUNK_INDEX_NULL = 0