Closed ChillerDragon closed 9 months ago
Some of them might be the team enum. But that depends on the gamemsg field and I do not think the current code supports such logic.
Correct.
I would love to add some if statements to the generated rust code but it seems wrong.
Yea, that would be wrong. The JSON is supposed to declaratively describe the protocol.
Not sure how complex the generation code would be if it would support if statements or field relations. Also might look ugly in the json. So I went with the raw i32 for now.
I agree, I think it'd be better to develop protocols where fields don't depend on values. Makes it easier to write parsers.
By the way is this command hidden in some generate_all script?
cd gamenet/generate
python3 serialize.py --version 0.7 raw/teeworlds-0.7.5.py > spec/teeworlds-0.7.5.json
It is quite tedious to type. Shouldn't that be included in here?
It is quite tedious to type. Shouldn't that be included in here?
It's kinda intentionally omitted because it's not supposed to be run regularly. I agree that this makes a bad contributor experience. Not sure what to do about it. :(
Para I-III are not i32 at all times. Some of them might be the team enum. But that depends on the gamemsg field and I do not think the current code supports such logic. I would love to add some if statements to the generated rust code but it seems wrong. Not sure how complex the generation code would be if it would support if statements or field relations. Also might look ugly in the json. So I went with the raw i32 for now.
If you need a refresher on what this message does I fully documented it here https://chillerdragon.github.io/teeworlds-protocol/07/game_messages.html#NETMSGTYPE_SV_GAMEMSG
Here is how it looks in action used by the wireshark dissector.
Before:
After: