home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Server/py: Remove superfluous line.
[plomrogue]
/
plomrogue-server.py
diff --git
a/plomrogue-server.py
b/plomrogue-server.py
index 6a486f6c707fc82457bcd89b03522726a0b8e810..fd3edbde27f09f9483e6f43772d56b24980272b3 100755
(executable)
--- a/
plomrogue-server.py
+++ b/
plomrogue-server.py
@@
-142,7
+142,7
@@
def obey(command, prefix, replay=False, do_record=False):
print("Invalid command/argument, or bad number of tokens.")
print("Invalid command/argument, or bad number of tokens.")
-def atomic_write(path, text, do_append=False):
+def atomic_write(path, text, do_append=False
, delete=True
):
"""Atomic write of text to file at path, appended if do_append is set."""
path_tmp = path + io_db["tmp_suffix"]
mode = "w"
"""Atomic write of text to file at path, appended if do_append is set."""
path_tmp = path + io_db["tmp_suffix"]
mode = "w"
@@
-153,7
+153,7
@@
def atomic_write(path, text, do_append=False):
file = open(path_tmp, mode)
strong_write(file, text)
file.close()
file = open(path_tmp, mode)
strong_write(file, text)
file.close()
- if os.access(path, os.F_OK):
+ if
delete and
os.access(path, os.F_OK):
os.remove(path)
os.rename(path_tmp, path)
os.remove(path)
os.rename(path_tmp, path)
@@
-348,7
+348,7
@@
def try_worldstate_update():
c = world_db["ThingTypes"][mt[0]]["TT_SYMBOL"]
mem[(mt[1] * length) + mt[2]] = ord(c)
string = write_map(string, mem)
c = world_db["ThingTypes"][mt[0]]["TT_SYMBOL"]
mem[(mt[1] * length) + mt[2]] = ord(c)
string = write_map(string, mem)
- atomic_write(io_db["path_worldstate"], string)
+ atomic_write(io_db["path_worldstate"], string
, delete=False
)
strong_write(io_db["file_out"], "WORLD_UPDATED\n")
io_db["worldstate_updateable"] = False
strong_write(io_db["file_out"], "WORLD_UPDATED\n")
io_db["worldstate_updateable"] = False
@@
-472,7
+472,6
@@
def update_map_memory(t, age_map=True):
t["T_MEMDEPTHMAP"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
ord_v = ord("v")
ord_0 = ord("0")
t["T_MEMDEPTHMAP"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
ord_v = ord("v")
ord_0 = ord("0")
- ord_9 = ord("9")
ord_space = ord(" ")
for pos in [pos for pos in range(world_db["MAP_LENGTH"] ** 2)
if ord_v == t["fovmap"][pos]]:
ord_space = ord(" ")
for pos in [pos for pos in range(world_db["MAP_LENGTH"] ** 2)
if ord_v == t["fovmap"][pos]]: