From 753f71536339b78c49468ba6452c96d6b3c345b2 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 10 Oct 2017 19:33:33 +0200 Subject: Finish work on world entities, start experimenting with world generation. --- src/procgen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/procgen.cpp') diff --git a/src/procgen.cpp b/src/procgen.cpp index 09ccae5..b5e1d6f 100644 --- a/src/procgen.cpp +++ b/src/procgen.cpp @@ -63,8 +63,9 @@ float perlin_noise_t::get(float x, float y, float scale) x /= scale; y /= scale; - nx = mod(floor(x), size); - ny = mod(floor(y), size); + nx = (ssize_t)floor(x) & (size - 1); + ny = (ssize_t)floor(y) & (size - 1); + nx1 = (nx == size - 1 ? 0 : nx + 1); ny1 = (ny == size - 1 ? 0 : ny + 1); -- cgit