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