home · contact · privacy
Server: Optimize thing position calculation.
[plomrogue] / server / io.py
index 01d04365770ace851b97568ea7f0c22cd19dc451..ad30cc2d1fe892e1fcdf65549d6d5fadb2aad60f 100644 (file)
@@ -174,8 +174,6 @@ def save_world():
                     x = world_db[category][_id][key]
                     argument = quote_escape(x) if str == type(x) else str(x)
                     string = string + key + " " + argument + "\n"
-                elif special_keys[key]:
-                    string = string + special_keys[key](_id)
         return string
 
     def helper_things():
@@ -187,32 +185,13 @@ def save_world():
             t = world_db["Things"][tid]
             for key in sorted(t.keys()):
                 if key not in {"T_CARRIES", "carried", "fovmap", "T_MEMMAP",
-                               "T_MEMTHING", "T_MEMDEPTHMAP"}:
+                               "T_MEMTHING", "T_MEMDEPTHMAP", "pos"}:
                     argument = t[key]
                     string += key + " " + (quote_escape(argument) if \
                             str == type(argument) else str(argument)) + "\n"
             string += memthing(tid) + memmap(tid) + memdepthmap(tid)
         return string
 
-    # ALTERNATIVE TO helper_things, but not more efficient despite listcomp
-    # def helper4():
-    #     def foo(t, key):
-    #         argument = t[key]
-    #         return key + " " + (quote_escape(argument) if \
-    #                 str == type(argument) else str(argument)) + "\n"
-    #     string = ""
-    #     memmap = mapsetter("T_MEMMAP")
-    #     memdepthmap = mapsetter("T_MEMDEPTHMAP")
-    #     for tid in sorted(world_db["Things"].keys()):
-    #         string += "T_ID " + str(tid) + "\n"
-    #         t = world_db["Things"][tid]
-    #         lines = [foo(t, key) for key in sorted(t.keys())
-    #                  if key not in {"T_CARRIES", "carried", "fovmap",
-    #                  "T_MEMMAP", "T_MEMTHING", "T_MEMDEPTHMAP"}]
-    #         string += "".join(lines)
-    #         string += memthing(tid) + memmap(tid) + memdepthmap(tid)
-    #     return string
-
     string = ""
     for plugin in world_db["PLUGIN"]:
         string = string + "PLUGIN " + plugin + "\n"
@@ -288,7 +267,7 @@ def obey(command, prefix, replay=False, do_record=False):
                     if world_db["WORLD_ACTIVE"]:
                         save_world()
                     io_db["record_chunk"] = ""
-                    io_db["save_wait"] = time.time()
+                    io_db["save_wait_start"] = time.time()
             io_db["worldstate_updateable"] = world_db["WORLD_ACTIVE"]
     elif 0 != len(tokens):
         print("Invalid command/argument, or bad number of tokens: " + command)