-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Define field script opcode constants #2005
base: master
Are you sure you want to change the base?
Conversation
Replace the magic number opcodes in field script command macros with these new constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the idea here and I think it will reduce mistakes, I just have a few comments on style :)
.ifndef ALLOCATE_SCRIPT_CMD_TABLE | ||
enum \constant | ||
.else | ||
.4byte \value | ||
.endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .if
/.ifne
would be clearer than .ifdef
/.ifndef
(and are necessary with an explicit .set ALLOCATION_SCRIPT_CMD_TABLE, 0
), e.g.:
.ifndef ALLOCATE_SCRIPT_CMD_TABLE | |
enum \constant | |
.else | |
.4byte \value | |
.endif | |
.if ALLOCATE_SCRIPT_CMD_TABLE | |
.4byte \value | |
.else | |
enum \constant | |
.endif |
@@ -1,52 +1,54 @@ | |||
.include "data/script_cmd_table.inc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to be explicit here:
.include "data/script_cmd_table.inc" | |
.set ALLOCATE_SCRIPT_CMD_TABLE, 0 | |
.include "data/script_cmd_table.inc" |
|
||
|
||
enum_start | ||
.ifdef ALLOCATE_SCRIPT_CMD_TABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ifdef ALLOCATE_SCRIPT_CMD_TABLE | |
.if ALLOCATE_SCRIPT_CMD_TABLE |
|
||
.ifdef ALLOCATE_SCRIPT_CMD_TABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ifdef ALLOCATE_SCRIPT_CMD_TABLE | |
.if ALLOCATE_SCRIPT_CMD_TABLE |
Description
Also replace the magic number opcodes in field script command macros with these new constants
Discord contact info
yoshord