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

StaticFlags: Implement CreatureTypeFlags from StaticFlags #546

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

insunaa
Copy link
Contributor

@insunaa insunaa commented Aug 9, 2024

🍰 Pullrequest

This PR implements adding CreatureTypeFlags from StaticFlags

UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x00000010 WHERE `CreatureTypeFlags`&0x00000001;
UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x00200000 WHERE `CreatureTypeFlags`&0x00000002;
UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x00010000 WHERE `CreatureTypeFlags`&0x00000004;
UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x00800000 WHERE `CreatureTypeFlags`&0x00000008;
UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x01000000 WHERE `CreatureTypeFlags`&0x00000010;
UPDATE `creature_template` SET `StaticFlags1`=`StaticFlags1`|0x40000000 WHERE `CreatureTypeFlags`&0x00000020;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00000008 WHERE `CreatureTypeFlags`&0x00000040;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00000800 WHERE `CreatureTypeFlags`&0x00000080;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00004000 WHERE `CreatureTypeFlags`&0x00000100;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00008000 WHERE `CreatureTypeFlags`&0x00000200;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00100000 WHERE `CreatureTypeFlags`&0x00000400;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x00040000 WHERE `CreatureTypeFlags`&0x00000800;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x20000000 WHERE `CreatureTypeFlags`&0x00001000;
UPDATE `creature_template` SET `StaticFlags2`=`StaticFlags2`|0x80000000 WHERE `CreatureTypeFlags`&0x00002000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00000008 WHERE `CreatureTypeFlags`&0x00004000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00000010 WHERE `CreatureTypeFlags`&0x00008000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00000200 WHERE `CreatureTypeFlags`&0x00010000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00010000 WHERE `CreatureTypeFlags`&0x00020000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00040000 WHERE `CreatureTypeFlags`&0x00040000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00400000 WHERE `CreatureTypeFlags`&0x00080000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x00002000 WHERE `CreatureTypeFlags`&0x00100000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x01000000 WHERE `CreatureTypeFlags`&0x00200000;
UPDATE `creature_template` SET `StaticFlags3`=`StaticFlags3`|0x20000000 WHERE `CreatureTypeFlags`&0x00400000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00000008 WHERE `CreatureTypeFlags`&0x00800000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00000010 WHERE `CreatureTypeFlags`&0x01000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00000020 WHERE `CreatureTypeFlags`&0x02000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00008000 WHERE `CreatureTypeFlags`&0x04000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00080000 WHERE `CreatureTypeFlags`&0x08000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x00200000 WHERE `CreatureTypeFlags`&0x10000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x20000000 WHERE `CreatureTypeFlags`&0x20000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x40000000 WHERE `CreatureTypeFlags`&0x40000000;
UPDATE `creature_template` SET `StaticFlags4`=`StaticFlags4`|0x80000000 WHERE `CreatureTypeFlags`&0x80000000;

@insunaa
Copy link
Contributor Author

insunaa commented Aug 9, 2024

Alternatively to changing cInfo with a const_cast I could probably also convert all occurences of CreatureTypeFlags to use StaticFlags

@insunaa
Copy link
Contributor Author

insunaa commented Aug 10, 2024

I had a look at how TrinityCore names the CreaturerTypeFlags and this confirmed that I got the flags correctly assigned, but their naming scheme is a bit different. Should I rename ours to match TC for easier compatibility?

@@ -1316,41 +1316,44 @@ enum CreatureFamily
CREATURE_FAMILY_SPIRIT_BEAST = 46
};

namespace CreatureTypeFlags
Copy link
Contributor

Choose a reason for hiding this comment

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

Do enum class instead of this

Copy link
Contributor

Choose a reason for hiding this comment

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

With the flag macro like settings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that, but it caused all kinds of annoyances with not being able to implicitly cast it to integer, so I changed it to a separate namespace instead. I still think that is the cleanest solution that avoids the BS-ery that are flag enums in C++

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put it into a separate commit so that if you don't want it, we can just drop the commit from the PR

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

Successfully merging this pull request may close these issues.

2 participants