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

refactor: Decouple attitude from creature #4069

Merged
merged 1 commit into from
Jan 6, 2024
Merged

refactor: Decouple attitude from creature #4069

merged 1 commit into from
Jan 6, 2024

Conversation

AluminumAlman
Copy link
Contributor

@AluminumAlman AluminumAlman commented Jan 6, 2024

Purpose of change

Decouple creature attitude from creature so as to reduce the inclusion of creature.h.

Describe the solution

Changed Attitude from being an internal enum of Creature to simply being an enum, now defined in enums.h. Fixed code after this refactor by bash scripts: for FILE in $(find ./ -name '*.cpp' -or -name '*.h'); do sed -i -E 's@(Creature::)*(Attitude::)*(A_HOSTILE|A_NEUTRAL|A_FRIENDLY|A_ANY)@Attitude::\3@g' $FILE; done , for FILE in $(find ./ -name '*.cpp' -or -name '*.h'); do sed -i -E 's@Creature::Attitude@Attitude@g' $FILE; done and for FILE in $(find ./ -name '*.cpp' -or -name '*.h'); do sed -i -E 's@MFAttitude::@MF@g' $FILE; done.

Describe alternatives you've considered

None.

Testing

Tested if the code compiles by make LUA=0 TILES=1 SOUND=1 RELEASE=1.

@github-actions github-actions bot added the src changes related to source code. label Jan 6, 2024
@scarf005 scarf005 self-requested a review January 6, 2024 12:21
@scarf005 scarf005 self-assigned this Jan 6, 2024
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but maybe we could use enum class

src/enums.h Show resolved Hide resolved
@scarf005
Copy link
Member

scarf005 commented Jan 6, 2024

oww, some functions used them as int
gotta fix it real quick

@scarf005 scarf005 merged commit fd4e650 into cataclysmbnteam:main Jan 6, 2024
6 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants