From 9f43e263fd48bf840d3b6225bf3367752a5575b5 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 29 May 2013 05:26:45 +0200
Subject: [PATCH] Working towards roguelike permadeath conventions: Saving
 happens automatically now at each new turn.

---
 keybindings | 1 -
 roguelike.c | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/keybindings b/keybindings
index 920c588..cb285c7 100644
--- a/keybindings
+++ b/keybindings
@@ -17,7 +17,6 @@
 95 shrink horizontally
 43 grow vertically
 45 shrink vertically
-115 save game
 119 map up
 120 map down
 97 map left
diff --git a/roguelike.c b/roguelike.c
index 6217fec..c68e983 100644
--- a/roguelike.c
+++ b/roguelike.c
@@ -232,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);
@@ -253,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"))
@@ -294,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"))
-- 
2.30.2