diff --git a/source/tools/mapcompatibility/a18_to_a19.py b/source/tools/mapcompatibility/a18_to_a19.py index ee677ccd12..24fe1c22dc 100755 --- a/source/tools/mapcompatibility/a18_to_a19.py +++ b/source/tools/mapcompatibility/a18_to_a19.py @@ -25,6 +25,7 @@ import argparse import io import os +import struct import sys parser = argparse.ArgumentParser(description="Convert maps compatible with 0 A.D. version Alpha XVIII (A18) to maps compatible with version Alpha XIX (A19), or the other way around.") @@ -51,27 +52,27 @@ for xmlFile in args.files: f2.write(f1.read(4)) # 4 bytes to encode the version of the file format - version = int.from_bytes(f1.read(4), byteorder='little') + version = struct.unpack(">' operator if args.no_height_change: @@ -86,8 +87,8 @@ for xmlFile in args.files: return h >> HEIGHTMAP_BIT_SHIFT for i in range(0, (map_size*16+1)*(map_size*16+1)): - height = int.from_bytes(f1.read(2), byteorder='little') - f2.write(height_transform(height).to_bytes(2, byteorder='little')) + height = struct.unpack("