Skip to content

Commit

Permalink
Add cata_variant type for achievement_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytheway committed May 29, 2020
1 parent 3efd7ed commit d5047ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cata_variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ std::string enum_to_string<cata_variant_type>( cata_variant_type type )
switch( type ) {
// *INDENT-OFF*
case cata_variant_type::void_: return "void";
case cata_variant_type::achievement_id: return "achievement_id";
case cata_variant_type::add_type: return "add_type";
case cata_variant_type::bionic_id: return "bionic_id";
case cata_variant_type::body_part: return "body_part";
Expand Down
6 changes: 5 additions & 1 deletion src/cata_variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum character_movemode : int;

enum class cata_variant_type : int {
void_, // Special type for empty variants
achievement_id,
add_type,
bionic_id,
body_part,
Expand Down Expand Up @@ -154,7 +155,7 @@ struct convert_enum {
};

// These are the specializations of convert for each value type.
static_assert( static_cast<int>( cata_variant_type::num_types ) == 23,
static_assert( static_cast<int>( cata_variant_type::num_types ) == 24,
"This assert is a reminder to add conversion support for any new types to the "
"below specializations" );

Expand All @@ -163,6 +164,9 @@ struct convert<cata_variant_type::void_> {
using type = void;
};

template<>
struct convert<cata_variant_type::achievement_id> : convert_string_id<achievement_id> {};

template<>
struct convert<cata_variant_type::add_type> : convert_enum<add_type> {};

Expand Down

0 comments on commit d5047ce

Please sign in to comment.