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: Make proper command_seedmap() refer to (dummy) remake_map().
[plomrogue]
/
plomrogue-server.py
diff --git
a/plomrogue-server.py
b/plomrogue-server.py
index 0098e472c22dee6857343892b3ef4e521015b79d..5a45c1b18b41fbd2b56956e3fb069c6d2c5d003e 100755
(executable)
--- a/
plomrogue-server.py
+++ b/
plomrogue-server.py
@@
-120,6
+120,7
@@
def save_world():
# Dummy for saving all commands to reconstruct current world state.
# Misses same optimizations as record() from the original record().
atomic_write(io_db["path_save"],
# Dummy for saving all commands to reconstruct current world state.
# Misses same optimizations as record() from the original record().
atomic_write(io_db["path_save"],
+ "PLAYER_TYPE " + str(world_db["PLAYER_TYPE"]) + "\n" +
"TURN " + str(world_db["TURN"]) + "\n" +
"SEED_RANDOMNESS " + str(world_db["SEED_RANDOMNESS"]) + "\n" +
"SEED_MAP " + str(world_db["SEED_MAP"]) + "\n")
"TURN " + str(world_db["TURN"]) + "\n" +
"SEED_RANDOMNESS " + str(world_db["SEED_RANDOMNESS"]) + "\n" +
"SEED_MAP " + str(world_db["SEED_MAP"]) + "\n")
@@
-237,6
+238,11
@@
def play_game():
obey(read_command(), "in file", do_record=True)
obey(read_command(), "in file", do_record=True)
+def remake_map():
+ # DUMMY.
+ print("I'd (re-)make the map now, if only I knew how.")
+
+
def worlddb_value_setter(key, min, max):
"""Generate: Set world_db[key] to int(val_string) if >= min and <= max."""
def func(val_string):
def worlddb_value_setter(key, min, max):
"""Generate: Set world_db[key] to int(val_string) if >= min and <= max."""
def func(val_string):
@@
-262,6
+268,12
@@
def command_quit():
raise SystemExit("received QUIT command")
raise SystemExit("received QUIT command")
+def command_seedmap(seed_string):
+ """Set world_db["SEED_MAP"] to int(seed_string), then (re-)make map."""
+ worlddb_value_setter("SEED_MAP", 0, 4294967295)(seed_string)
+ remake_map()
+
+
def command_makeworld(seed_string):
# Mere dummy so far.
worlddb_value_setter("SEED_MAP", 0, 4294967295)(seed_string)
def command_makeworld(seed_string):
# Mere dummy so far.
worlddb_value_setter("SEED_MAP", 0, 4294967295)(seed_string)
@@
-279,10
+291,11
@@
commands_db = {
"QUIT": (0, True, command_quit),
"PING": (0, True, command_ping),
"MAKE_WORLD": (1, False, command_makeworld),
"QUIT": (0, True, command_quit),
"PING": (0, True, command_ping),
"MAKE_WORLD": (1, False, command_makeworld),
- "SEED_MAP": (1, False,
worlddb_value_setter("SEED_MAP", 0, 4294967295)
),
+ "SEED_MAP": (1, False,
command_seedmap
),
"SEED_RANDOMNESS": (1, False, worlddb_value_setter("SEED_RANDOMNESS", 0,
4294967295)),
"SEED_RANDOMNESS": (1, False, worlddb_value_setter("SEED_RANDOMNESS", 0,
4294967295)),
- "TURN": (1, False, worlddb_value_setter("TURN", 0, 65535))
+ "TURN": (1, False, worlddb_value_setter("TURN", 0, 65535)),
+ "PLAYER_TYPE": (1, False, worlddb_value_setter("PLAYER_TYPE", 0, 255))
}
}
@@
-290,7
+303,8
@@
commands_db = {
world_db = {
"TURN": 0,
"SEED_MAP": 0,
world_db = {
"TURN": 0,
"SEED_MAP": 0,
- "SEED_RANDOMNESS": 0
+ "SEED_RANDOMNESS": 0,
+ "PLAYER_TYPE": 0
}
}