home · contact · privacy
Re-seed rrand() with a new but predictable seed each new turn.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 29 May 2013 03:17:14 +0000 (05:17 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 29 May 2013 03:17:14 +0000 (05:17 +0200)
roguelike.c

index 0de96ee87ede95cd6018b7873e3a9aa1b77e2529..6217fec2713128b4b4987c52f5f34e841da66078 100644 (file)
@@ -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;