From: Christian Heller Date: Wed, 2 Mar 2016 01:53:54 +0000 (+0100) Subject: Server: Simplify code. X-Git-Tag: tce~102 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/template?a=commitdiff_plain;h=e8c627dc4dde2d6b60597a34d1594e7ae5b86b8c;p=plomrogue Server: Simplify code. --- diff --git a/server/io.py b/server/io.py index a483e2d..bb5d3ac 100644 --- a/server/io.py +++ b/server/io.py @@ -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(): @@ -194,25 +192,6 @@ def save_world(): 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"