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

Projects
None yet
4 participants
@fmatthew5876
Contributor

fmatthew5876 commented Sep 30, 2018

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

Show resolved Hide resolved src/enum_tags.h
@fmatthew5876

This comment has been minimized.

Contributor

fmatthew5876 commented Sep 30, 2018

Added to Makefile.am

@Ghabry

This comment has been minimized.

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

This comment has been minimized.

Contributor

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.

@Ghabry Ghabry added this to the 0.5.4 milestone Oct 2, 2018

@Ghabry

Ghabry approved these changes Oct 2, 2018

@Ghabry

This comment has been minimized.

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

5 checks passed

GCW0 Build finished.
Details
GNU/Linux Build finished.
Details
OSX Build finished.
Details
Windows Build finished.
Details
web Build finished.
Details

@fmatthew5876 fmatthew5876 deleted the fmatthew5876:ldb_enums branch Oct 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment