Intentionally keep enums ints

https://gitlab.com/teeworlds-network/twnet_parser/-/issues/7
This commit is contained in:
ChillerDragon 2023-04-16 11:25:31 +02:00
parent 67c54c4be4
commit 1fd099c3de

View file

@ -193,9 +193,11 @@ def gen_unpack_members(msg: NetMessageJson) -> str:
else:
unpacker = 'str()'
elif arr_member['kind'] == 'enum':
# TODO: can we represent the enum as text
# instead of as magic number?
unpacker = 'int() # TODO: this is a enum'
# We intentionally do not do anything fancy here
# no enums for example because it comes with too many
# disadvantages see the related issue here
# https://gitlab.com/teeworlds-network/twnet_parser/-/issues/7
unpacker = 'int()'
elif arr_member['kind'] == 'boolean':
unpacker = 'int() == 1'
elif arr_member['kind'] in ('int32', 'tick'):