Files
Navmesher_old/gen_rt2rth.py
2022-09-05 13:51:05 +10:00

23 lines
490 B
Python

with open("record_types.txt", "r") as f:
data = f.read()
GROUPING = 3
PREFIX = "RT_"
line = []
out = ""
for i, l in enumerate(data.split("\n")):
word = l.strip()
#bytes_ = [ord(c) for c in word]
#le_hex = "".join([hex(c)[2:] for c in reversed(bytes_)])
#line += [f"0x{le_hex}u"]
line += [f"[{word}] = {PREFIX}{word}"]
if (i + 1) % GROUPING == 0:
out += ", ".join(line) + ",\n"
line = []
if line:
out += ", ".join(line) + ",\n"
print(out)