Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style: State machines should have constants defined for them to make them easier to modify #222

Closed
Tracked by #220
luckytyphlosion opened this issue Aug 18, 2023 · 4 comments

Comments

@luckytyphlosion
Copy link
Member

Useful grep command: grep -Pzowr --include="*.c" --include="*.h" --exclude-dir="tools" --exclude-dir="sub" --exclude-dir="lib" --exclude-dir=".github" --exclude-dir="files" 'switch \([^{]+\n?[^{\n]*{(?:\s+//.*?\n)*\s*case (?:(?:0x[0-9a-f]+|[0-9])*\s*[&\*\+-/\|]*)+:.*?\n' | tr -d '\000'

Unfortunately does not catch switch statements starting with default:, so a custom tool would need to be made

@luckytyphlosion
Copy link
Member Author

Should also probably make unknown enums even if they're something like SUB_02031780_UNK_STATE_0

@PikalaxALT
Copy link
Collaborator

Not entirely necessary for all state machines, but for the uber important ones (field loop, script processor, etc.), and for any SMs reached going forward, this should be implemented. Low priority.

@tgsm
Copy link
Collaborator

tgsm commented Aug 19, 2023

Not entirely necessary for all state machines, but for the uber important ones (field loop, script processor, etc.), and for any SMs reached going forward, this should be implemented. Low priority.

I agree with this.

@adrienntindall
Copy link
Collaborator

I agree with low priority and personally, I only care about the state constants when the functions get documented. Will point out when documented state machines need their constants going forward etc and everyone else should do the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants