X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomrogue-server.py;h=db297952c4ca3d0756bf277fee9313827edfd4f1;hb=f1b54d65ab5807797ece8b682803d44e8eb4af41;hp=4cb138a3a6da7b2af8b11fa80b84b6dc784d653f;hpb=7c9c3b3cc0044de265b845eec1a71d9bc3577105;p=plomrogue diff --git a/plomrogue-server.py b/plomrogue-server.py index 4cb138a..db29795 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -369,7 +369,7 @@ def command_makeworld(seed_string): def command_maplength(maplength_string): # DUMMY. set_world_inactive() - # TODO: remove map + # TODO: remove map (is this necessary? no memory management trouble …) world_db["Things"] = {} setter(None, "MAP_LENGTH", 1, 256)(maplength_string) @@ -378,18 +378,25 @@ def command_worldactive(worldactive_string): # DUMMY. val = integer_test(worldactive_string, 0, 1) if val: - if 0 != world_db["WORLD_ACTIVE"] and 0 == val: - set_world_inactive() + if 0 != world_db["WORLD_ACTIVE"]: + if 0 == val: + set_world_inactive() + else: + print("World already active.") elif 0 == world_db["WORLD_ACTIVE"]: wait_exists = False + for ThingAction in world_db["ThingActions"]: + if "wait" == ThingAction["TA_NAME"]: + wait_exists = True + break player_exists = False - map_exists = False - # TODO: perform tests: - # Is there thing action of name 'wait'? - # Is there a player thing? - # Is there a map? + for Thing in world_db["Things"]: + if 0 == ThingAction["T_ID"]: + player_exists = True + break + map_exists = "MAP" in world_db if wait_exists and player_exists and map_exists: - # TODO: rebuild al things' FOVs, map memories + # TODO: rebuild all things' FOVs, map memories world_db["WORLD_ACTIVE"] = 1