X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=roguelike.c;h=c68e983705466eac6a3f920127070b3ca51486bb;hb=9f43e263fd48bf840d3b6225bf3367752a5575b5;hp=0de96ee87ede95cd6018b7873e3a9aa1b77e2529;hpb=c1a11c82ca5dd7aa7b48e79b72fcb0112565e1bc;p=plomrogue
diff --git a/roguelike.c b/roguelike.c
index 0de96ee..c68e983 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;
@@ -231,7 +232,7 @@ int main (int argc, char *argv[]) {
monster.y = 55;
monster.x = 55;
world.seed = time(NULL);
- world.turn = 0; }
+ world.turn = 1; }
rrand(1, world.seed);
init_keybindings(&world);
@@ -252,7 +253,11 @@ int main (int argc, char *argv[]) {
struct Win win_log = init_window(&win_meta, "Log", &world, draw_log_win);
int key;
+ uint32_t last_turn = 0;
while (1) {
+ if (last_turn != world.turn) {
+ save_seed(&world);
+ last_turn = world.turn; }
draw_all_windows (&win_meta);
key = getch();
if (key == get_action_key(world.keybindings, "quit"))
@@ -293,8 +298,6 @@ int main (int argc, char *argv[]) {
keyswin_move_selection (&world, 'd');
else if (key == get_action_key(world.keybindings, "keys mod"))
keyswin_mod_key (&world, &win_meta);
- else if (key == get_action_key(world.keybindings, "save game"))
- save_seed(&world);
else if (key == get_action_key(world.keybindings, "map up"))
map_scroll (&map, 'n');
else if (key == get_action_key(world.keybindings, "map down"))