-
Notifications
You must be signed in to change notification settings - Fork 924
Simplified ParseMonsterId() by using the magic_enum library #8090
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
Conversation
|
Will you be able to fix this for other builds? Since most fail from it we can't really merge it as is. |
I think yes, but I'll need some time, since I need to figure out what is wrong, and I don't have any leads at the moment. I think during next week I'll be able to fix this. |
|
A dependency on magic enum needs to be added to the libdevilutionx CMake target |
f9600c6 to
5449984
Compare
Yup, that was it :) Thank you so much! |
|
|
||
| tl::expected<_monster_id, std::string> ParseMonsterId(std::string_view value) | ||
| { | ||
| if (value == "MT_NZOMBIE") return MT_NZOMBIE; |
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.
What happens once this is renamed to MonsterType::Zombie? Ideal it should produce Zombie
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.
Yes, that's exactly what it would produce :)
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.
In that case could you resolve the merge conflict, after that i think it's ready to merge.
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 fixed the merge conflicts now :)
This pull request adds the (header-only) magic_enum library as a dependency, and uses it to simplify ParseMonsterId(). The library could be used in the future to simplify other similar functions as well.