From: Christian Heller Date: Wed, 29 May 2013 03:17:14 +0000 (+0200) Subject: Re-seed rrand() with a new but predictable seed each new turn. X-Git-Tag: tce~1264 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/edit?a=commitdiff_plain;h=98588def4ac3ab05cb815814de67a44f506ae569;p=plomrogue Re-seed rrand() with a new but predictable seed each new turn. --- diff --git a/roguelike.c b/roguelike.c index 0de96ee..6217fec 100644 --- a/roguelike.c +++ b/roguelike.c @@ -134,6 +134,7 @@ void map_scroll (struct Map * map, char dir) { void next_turn (struct World * world) { // Increment turn and move enemy. world->turn++; + rrand(1, world->seed * world->turn); char d = rrand(0, 0) % 5; uint16_t ty = world->monster->y; uint16_t tx = world->monster->x;