From bcc49cb62e6e4495db8c1826f8ab651c4eea988d Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 1 Sep 2015 01:38:45 +0200
Subject: [PATCH] Don't save non-active world.

---
 roguelike-server | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/roguelike-server b/roguelike-server
index 5b37324..7e59152 100755
--- a/roguelike-server
+++ b/roguelike-server
@@ -139,7 +139,8 @@ def obey(command, prefix, replay=False, do_record=False):
                 if time.time() > io_db["save_wait"] + 15:
                     atomic_write(io_db["path_record"], io_db["record_chunk"],
                                  do_append=True)
-                    save_world()
+                    if world_db["WORLD_ACTIVE"]:
+                        save_world()
                     io_db["record_chunk"] = ""
                     io_db["save_wait"] = time.time()
             io_db["worldstate_updateable"] = world_db["WORLD_ACTIVE"]
@@ -1116,7 +1117,8 @@ def command_ping():
 def command_quit():
     """Abort server process."""
     if None == opts.replay:
-        save_world()
+        if world_db["WORLD_ACTIVE"]:
+            save_world()
         atomic_write(io_db["path_record"], io_db["record_chunk"], do_append=True)
     raise SystemExit("received QUIT command")
 
-- 
2.30.2