1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-01 23:25:09 +02:00

implement block mining conditions

This commit is contained in:
p2r3
2025-08-13 20:57:58 +03:00
parent 94b3682f0a
commit 2ab196e5f0
7 changed files with 75 additions and 15 deletions

8
main.c
View File

@@ -282,6 +282,14 @@ int main () {
sc_keepAlive(client_fd);
sc_updateTime(client_fd, world_time += 200);
clock_gettime(CLOCK_REALTIME, &keepalive_last);
/**
* If the RNG seed ever hits 0, it'll never generate anything
* else. This is because the fast_rand function uses a simple
* XORshift. This isn't a common concern, so we only check for
* this periodically. If it does become zero, we reset it to
* the world seed as a good-enough fallback.
*/
if (rng_seed == 0) rng_seed = world_seed;
}
}