X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;ds=sidebyside;f=roguelike-server;h=378f0aff96ad0f8f78c4d58ed7e07699e5218960;hb=20892bf24485a644db81e12636cd189ae3482ab8;hp=860cd1ad2a47129df5a8f88ebd45e20bf7e69cc3;hpb=d8143f05add023ec94dec4725c85811b3da22471;p=plomrogue diff --git a/roguelike-server b/roguelike-server index 860cd1a..378f0af 100755 --- a/roguelike-server +++ b/roguelike-server @@ -414,7 +414,7 @@ def play_game(): obey(read_command(), "in file", do_record=True) -def remake_map(): +def make_map(): """(Re-)make island map. Let "~" represent water, "." land, "X" trees: Build island shape randomly, @@ -1200,7 +1200,7 @@ def command_makeworld(seed_string): Seed rand with seed. Do more only with a "wait" ThingAction and world["PLAYER_TYPE"] matching ThingType of TT_START_NUMBER > 0. Then, - world_db["Things"] emptied, call remake_map() and set + world_db["Things"] emptied, call make_map() and set world_db["WORLD_ACTIVE"], world_db["TURN"] to 1. Build new Things according to ThingTypes' TT_START_NUMBERS, with Thing of ID 0 to ThingType of ID = world["PLAYER_TYPE"]. Place Things randomly, and actors not on each @@ -1251,7 +1251,7 @@ def command_makeworld(seed_string): "No thing action with name 'wait' defined.") return world_db["Things"] = {} - remake_map() + make_map() world_db["WORLD_ACTIVE"] = 1 world_db["TURN"] = 1 for i in range(world_db["ThingTypes"][playertype]["TT_START_NUMBER"]): @@ -1271,6 +1271,7 @@ def command_maplength(maplength_string): val = integer_test(maplength_string, 1, 256) if None != val: world_db["MAP_LENGTH"] = val + world_db["MAP"] = False set_world_inactive() world_db["Things"] = {} libpr.set_maplength(val) @@ -1301,7 +1302,7 @@ def command_worldactive(worldactive_string): if 0 == Thing: player_exists = True break - if wait_exists and player_exists and "MAP" in world_db: + if wait_exists and player_exists and world_db["MAP"]: for id in world_db["Things"]: if world_db["Things"][id]["T_LIFEPOINTS"]: build_fov_map(world_db["Things"][id]) @@ -1425,12 +1426,12 @@ def setter_map(maptype): val = valid_map_line(str_int, mapline) if None != val: length = world_db["MAP_LENGTH"] - if not "MAP" in world_db: + if not world_db["MAP"]: map = bytearray(b' ' * (length ** 2)) else: map = world_db["MAP"] map[val * length:(val * length) + length] = mapline.encode() - if not "MAP" in world_db: + if not world_db["MAP"]: world_db["MAP"] = map @test_Thing_id @@ -1623,6 +1624,7 @@ world_db = { "MAP_LENGTH": 64, "PLAYER_TYPE": 0, "WORLD_ACTIVE": 0, + "MAP": False, "ThingActions": {}, "ThingTypes": {}, "Things": {}