From d5047cea20ab7253fbbde34cc8099672621a16fc Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Thu, 28 May 2020 21:52:22 -0400 Subject: [PATCH] Add cata_variant type for achievement_id --- src/cata_variant.cpp | 1 + src/cata_variant.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cata_variant.cpp b/src/cata_variant.cpp index 6dd9dda1dbf3a..54c4ae1d62f15 100644 --- a/src/cata_variant.cpp +++ b/src/cata_variant.cpp @@ -9,6 +9,7 @@ std::string enum_to_string( 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"; diff --git a/src/cata_variant.h b/src/cata_variant.h index 1f0eaa65728c2..98d149b4aa8e8 100644 --- a/src/cata_variant.h +++ b/src/cata_variant.h @@ -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, @@ -154,7 +155,7 @@ struct convert_enum { }; // These are the specializations of convert for each value type. -static_assert( static_cast( cata_variant_type::num_types ) == 23, +static_assert( static_cast( cata_variant_type::num_types ) == 24, "This assert is a reminder to add conversion support for any new types to the " "below specializations" ); @@ -163,6 +164,9 @@ struct convert { using type = void; }; +template<> +struct convert : convert_string_id {}; + template<> struct convert : convert_enum {};