From 8f4f9da4d1c2715fbd5eff732b3b86822696e2c3 Mon Sep 17 00:00:00 2001 From: Williham Totland Date: Wed, 16 Jan 2013 14:57:53 +0100 Subject: [PATCH 1/4] Improved autosave semantics. Autosaves no longer occur if you are standing still, sleeping, etc. --- game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game.cpp b/game.cpp index d9050023fa03c..4000638471abf 100644 --- a/game.cpp +++ b/game.cpp @@ -646,7 +646,7 @@ bool game::do_turn() u.get_sick(this); // Auto-save on the half-hour if autosave is enabled if (OPTIONS[OPT_AUTOSAVE]) - save(); + autosave(); } // Update the weather, if it's time. if (turn >= nextweather) @@ -7894,7 +7894,7 @@ void game::autosave() { if (!moves_since_last_save && !item_exchanges_since_save) return; - MAPBUFFER.save(); + save(); moves_since_last_save = 0; item_exchanges_since_save = 0; } From 0588d00b054be89e7200d969cf26b7cd9ca3b8a6 Mon Sep 17 00:00:00 2001 From: Williham Totland Date: Wed, 16 Jan 2013 15:04:01 +0100 Subject: [PATCH 2/4] Suppress autosave in vehicles. --- game.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/game.cpp b/game.cpp index 6407fbcfd9c4e..85c958846579e 100644 --- a/game.cpp +++ b/game.cpp @@ -665,7 +665,7 @@ bool game::do_turn() cleanup_dead(); if (!u.has_disease(DI_SLEEP) && u.activity.type == ACT_NULL) draw(); - if( get_input(autosave_timeout()) == IR_TIMEOUT && !u.in_vehicle) + if( get_input(autosave_timeout()) == IR_TIMEOUT) { autosave(); return false; @@ -7892,11 +7892,13 @@ int game::autosave_timeout() void game::autosave() { - if (!moves_since_last_save && !item_exchanges_since_save) - return; - save(); - moves_since_last_save = 0; - item_exchanges_since_save = 0; + if (!moves_since_last_save && !item_exchanges_since_save && !u.in_vehicle) + return; + + save(); + + moves_since_last_save = 0; + item_exchanges_since_save = 0; } void intro() From 5452d36fd835887ad3cd0f40990969138291301d Mon Sep 17 00:00:00 2001 From: Williham Totland Date: Wed, 16 Jan 2013 15:52:07 +0100 Subject: [PATCH 3/4] ACTUALLY suppressed saves in vehicles. --- game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.cpp b/game.cpp index 85c958846579e..f6c9902a93a0e 100644 --- a/game.cpp +++ b/game.cpp @@ -7892,7 +7892,7 @@ int game::autosave_timeout() void game::autosave() { - if (!moves_since_last_save && !item_exchanges_since_save && !u.in_vehicle) + if (u.in_vehicle || !moves_since_last_save && !item_exchanges_since_save) return; save(); From df5fc6946c9e2f426b8e028d8363af274a52f5bb Mon Sep 17 00:00:00 2001 From: Williham Totland Date: Wed, 16 Jan 2013 18:24:56 +0100 Subject: [PATCH 4/4] And finally, ACTUALLY improved autosave semantics. Sleeping and waiting should now only give one autosave, at the very beginning of the action. --- game.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/game.cpp b/game.cpp index f6c9902a93a0e..51dd59ae8e42a 100644 --- a/game.cpp +++ b/game.cpp @@ -665,28 +665,12 @@ bool game::do_turn() cleanup_dead(); if (!u.has_disease(DI_SLEEP) && u.activity.type == ACT_NULL) draw(); - if( get_input(autosave_timeout()) == IR_TIMEOUT) - { - autosave(); - return false; - } - if (is_game_over()) { - if (uquit == QUIT_DIED) - popup_top("Game over! Press spacebar..."); - if (uquit == QUIT_DIED || uquit == QUIT_SUICIDE) - death_screen(); - if (uquit == QUIT_DIED || uquit == QUIT_SUICIDE) - { - if (OPTIONS[OPT_DELETE_WORLD] == 1) - uquit = QUIT_DELETE_WORLD; - else if (OPTIONS[OPT_DELETE_WORLD] == 2) - if (query_yn("Delete the world and all saves?")) - uquit = QUIT_DELETE_WORLD; - } - return true; - } + + if (get_input(autosave_timeout()) == IR_GOOD) + ++moves_since_last_save; + + return false; } - ++moves_since_last_save; update_scent(); m.vehmove(this); m.process_fields(this);