logicomacorp / WaveSabre

Official WaveSabre repository
MIT License
245 stars 33 forks source link

Converter: Refactor song diffs to use reflection, update refs #76

Closed yupferris closed 3 years ago

yupferris commented 3 years ago

The previous approach was very repetitive and error-prone. It was extremely easy to forget to add checks for new fields in the Song structure, so when we added some additional fields/optimizations, we forgot to update the tests. Further, the original test code was wrong, so the refs were missing some information to begin with.

By using reflection, we guarantee that all fields are always covered, without any manual intervention (for now; we may have to add more stuff if we use more structures than just simple values and lists, but I suspect things will blow up in a noticeable way when/if that happens (if the existing checks/exceptions don't already cover it)) so we should be fairly future-proof now.

Also update all refs. Most were simply out-of-date wrt newer fields related to song optimizations; a few were missing fields that we missed in the original diffing code/ref gen.

Also includes lots of small cleanups (removing unused/redundant fields, some typo fixes).

Fixes #63.