Exemplo n.º 1
0
def main(args):
    if args.inline:
        updates = [args.update_source]
    else:
        with open(args.update_source) as f:
            updates = [line for line in f if line and not line.startswith("#") and not line.isspace()]

    if args.map:
        update_map(args.map, updates, verbose=args.verbose)
    else:
        map_directory = args.directory or frontend.read_settings().map_folder
        update_all_maps(map_directory, updates, verbose=args.verbose)
Exemplo n.º 2
0
def main(args):
    if args.inline:
        updates = [args.update_source]
    else:
        with open(args.update_source) as f:
            updates = [line for line in f if line and not line.startswith("#") and not line.isspace()]

    if args.map:
        update_map(args.map, updates, verbose=args.verbose)
    else:
        map_directory = args.directory or frontend.read_settings().map_folder
        update_all_maps(map_directory, updates, verbose=args.verbose)
Exemplo n.º 3
0
def main(args):
    if args.inline:
        print("Using replacement:", args.update_source)
        updates = [args.update_source]
    else:
        with open(args.update_source) as f:
            updates = [line for line in f if line and not line.startswith("#") and not line.isspace()]
        print(f"Using {len(updates)} replacements from file:", args.update_source)

    if args.map:
        update_map(args.map, updates, verbose=args.verbose)
    else:
        map_directory = args.directory or frontend.read_settings().map_folder
        update_all_maps(map_directory, updates, verbose=args.verbose)
Exemplo n.º 4
0
#!/usr/bin/env python3
import frontend
import dmm

if __name__ == '__main__':
    settings = frontend.read_settings()
    for fname in frontend.process(settings, "convert"):
        dmm.DMM.from_file(fname).to_file(fname, settings.tgm)
Exemplo n.º 5
0
    # step two: delete unused keys
    if unused_keys:
        print(f"Notice: Trimming {len(unused_keys)} unused dictionary keys.")
        for key in unused_keys:
            del merged.dictionary[key]

    # sanity check: that the merged map equals the new map
    for z, y, x in new_map.coords_zyx:
        new_tile = new_map.dictionary[new_map.grid[x, y, z]]
        merged_tile = merged.dictionary[merged.grid[x, y, z]]
        if new_tile != merged_tile:
            print(f"Error: the map has been mangled! This is a mapmerge bug!")
            print(f"At {x},{y},{z}.")
            print(f"Should be {new_tile}")
            print(f"Instead is {merged_tile}")
            raise RuntimeError()

    return merged


def main(settings):
    for fname in frontend.process(settings, "merge", backup=True):
        old_map = DMM.from_file(fname + ".backup")
        new_map = DMM.from_file(fname)
        merge_map(old_map, new_map).to_file(fname, settings.tgm)


if __name__ == '__main__':
    main(frontend.read_settings())
Exemplo n.º 6
0
#!/usr/bin/env python3
import frontend
import dmm

if __name__ == '__main__':
    settings = frontend.read_settings()
    for fname in frontend.process(settings, "convert"):
        dmm.DMM.from_file(fname).to_file(fname, settings.tgm)
Exemplo n.º 7
0
            select_key(fresh_key)

    # step two: delete unused keys
    if unused_keys:
        print(f"Notice: Trimming {len(unused_keys)} unused dictionary keys.")
        for key in unused_keys:
            del merged.dictionary[key]

    # sanity check: that the merged map equals the new map
    for z, y, x in new_map.coords_zyx:
        new_tile = new_map.dictionary[new_map.grid[x, y, z]]
        merged_tile = merged.dictionary[merged.grid[x, y, z]]
        if new_tile != merged_tile:
            print(f"Error: the map has been mangled! This is a mapmerge bug!")
            print(f"At {x},{y},{z}.")
            print(f"Should be {new_tile}")
            print(f"Instead is {merged_tile}")
            raise RuntimeError()

    return merged

def main(settings):
    for fname in frontend.process(settings, "merge", backup=True):
        shutil.copyfile(fname, fname + ".before")
        old_map = DMM.from_file(fname + ".backup")
        new_map = DMM.from_file(fname)
        merge_map(new_map, old_map).to_file(fname, settings.tgm)

if __name__ == '__main__':
    main(frontend.read_settings())