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

Add EnumTags class and generate tags for all enums #241

Merged
merged 4 commits into from Oct 4, 2018

Conversation

fmatthew5876
Copy link
Contributor

Introduces an enum_tags<E,N> class which provides enum to string functionality. Generator creates these for all RPG enums.

src/enum_tags.h Show resolved Hide resolved
@fmatthew5876
Copy link
Contributor Author

Added to Makefile.am

@Ghabry
Copy link
Member

Ghabry commented Oct 1, 2018

Sorry for this basic question but how am I supposed to use this? The template looks pretty straight-forward but I'm lost.

As an example lets say I want a tag-iterator for RPG::Item::Type. (accessing kTypeTags directly doesn't work, gives linker error)

@fmatthew5876 fmatthew5876 force-pushed the ldb_enums branch 2 times, most recently from d5835d3 to 6733857 Compare October 1, 2018 23:28
@fmatthew5876
Copy link
Contributor Author

fmatthew5876 commented Oct 1, 2018

Sorry for this basic question but how am I supposed to use this? The template looks pretty straight-forward but I'm lost.

As an example lets say I want a tag-iterator for RPG::Item::Type.

You can use it like this:

for (auto& x: RPG::Skill::kTypeTags) {
    std::cout << x << std::endl;
}
std::cout << RPG::Skill::kTypeTags[RPG::Skill::Type_normal] << std::endl;

(accessing kTypeTags directly doesn't work, gives linker error)

My fault. I forgot to provide definitions for these. static variables require a definition, although a lot of times you can get away without one in release builds.

I've added a new .cpp file for the definitions. I also found that EventCommands/MoveCommands Code::Index was missing tags. (This is actually where I wanted this feature the most!)

I've rebased this branch onto master directly, as the other stuff is not really dependent on it.

@fmatthew5876 fmatthew5876 force-pushed the ldb_enums branch 2 times, most recently from 1549440 to 49613ef Compare October 1, 2018 23:38
@Ghabry Ghabry added this to the 0.5.4 milestone Oct 2, 2018
@Ghabry
Copy link
Member

Ghabry commented Oct 2, 2018

(just updated the MSVC project file, some final love for it before we drop it after 0.5.4 ^^)

@carstene1ns carstene1ns merged commit 9b50762 into EasyRPG:master Oct 4, 2018
@fmatthew5876 fmatthew5876 deleted the ldb_enums branch October 11, 2018 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants