def within_dungeon(world, player):
    fix_big_key_doors_with_ugly_smalls(world, player)
    overworld_prep(world, player)
    (entrances_map, potentials, connections) = determine_entrance_list(world, player)
    connections_tuple = (entrances_map, potentials, connections)
    dungeon_builders = {}
    for key in dungeon_regions.keys():
        sector_list = convert_to_sectors(dungeon_regions[key], world, player)
        dungeon_builders[key] = simple_dungeon_builder(key, sector_list)
        dungeon_builders[key].entrance_list = list(entrances_map[key])
    recombinant_builders = {}
    handle_split_dungeons(dungeon_builders, recombinant_builders, entrances_map)
    main_dungeon_generation(dungeon_builders, recombinant_builders, connections_tuple, world, player)
    paths = determine_required_paths(world, player)
    check_required_paths(paths, world, player)
    start = time.process_time()
    for builder in world.dungeon_layouts[player].values():
        shuffle_key_doors(builder, world, player)
    logging.getLogger('').info('Key door shuffle time: %s', (time.process_time() - start))
    smooth_door_pairs(world, player)
def within_dungeon(world, player):
    fix_big_key_doors_with_ugly_smalls(world, player)
    overworld_prep(world, player)
    (entrances_map, potentials, connections) = determine_entrance_list(world, player)
    connections_tuple = (entrances_map, potentials, connections)
    dungeon_builders = {}
    for key in dungeon_regions.keys():
        sector_list = convert_to_sectors(dungeon_regions[key], world, player)
        dungeon_builders[key] = simple_dungeon_builder(key, sector_list)
        dungeon_builders[key].entrance_list = list(entrances_map[key])
    recombinant_builders = {}
    handle_split_dungeons(dungeon_builders, recombinant_builders, entrances_map)
    main_dungeon_generation(dungeon_builders, recombinant_builders, connections_tuple, world, player)
    paths = determine_required_paths(world, player)
    check_required_paths(paths, world, player)
    start = time.process_time()
    for builder in world.dungeon_layouts[player].values():
        shuffle_key_doors(builder, world, player)
    logging.getLogger().info('Key door shuffle time: %s', (time.process_time() - start))
    smooth_door_pairs(world, player)