aboutsummaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-25 20:21:50 -0500
committermat <github@matdoes.dev>2022-05-25 20:21:50 -0500
commit9d0de818f8306a401efcd9244c6e06aa5e8189db (patch)
treef5c2a0aa062fdf52eb06e8a93f425fb1ea19c360 /codegen
parent9f192301facdb35157c5de105f6390b2de317ac4 (diff)
downloadazalea-drasl-9d0de818f8306a401efcd9244c6e06aa5e8189db.tar.xz
fixed changing packet ids
Diffstat (limited to 'codegen')
-rw-r--r--codegen/migrate.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/codegen/migrate.py b/codegen/migrate.py
index f15844d9..890186b8 100644
--- a/codegen/migrate.py
+++ b/codegen/migrate.py
@@ -38,8 +38,8 @@ for packet, packet_name in old_packets.items():
if packet_name not in new_packets.values():
removed_packets.append(packet)
print('Removed packet:', packet, packet_name)
-# for (direction, state), packets in group_packets(removed_packets).items():
-# lib.code.packet.remove_packet_ids(packets, direction, state)
+for (direction, state), packets in group_packets(removed_packets).items():
+ lib.code.packet.remove_packet_ids(packets, direction, state)
print()
@@ -52,8 +52,14 @@ for old_packet, old_packet_name in old_packets.items():
print('Changed packet id:', old_packet, '->',
new_packet, f'({new_packet_name})')
break
-# for (direction, state), packets in group_packets(list(changed_packets.keys())).items():
-# lib.code.packet.remove_packet_ids(packets, direction, state)
+for (direction, state), packets in group_packets(list(changed_packets.keys())).items():
+ id_map: dict[int, int] = {}
+ for old_packet_id in packets:
+ new_packet_id = changed_packets[PacketIdentifier(
+ old_packet_id, direction, state)]
+ id_map[old_packet_id] = new_packet_id
+
+ lib.code.packet.change_packet_ids(id_map, direction, state)
print()
@@ -64,9 +70,9 @@ for packet, packet_name in new_packets.items():
if packet_name not in old_packets.values():
added_packets.append(packet)
print('Added packet:', packet, packet_name)
-# for packet in added_packets:
-# lib.code.packet.generate_packet(
-# new_burger_data[0]['packets']['packet'], new_mappings, packet.packet_id, packet.direction, packet.state)
+for packet in added_packets:
+ lib.code.packet.generate_packet(
+ new_burger_data[0]['packets']['packet'], new_mappings, packet.packet_id, packet.direction, packet.state)
lib.code.utils.fmt()
print('Done!')