diff --git a/data/mods/Magiclysm/recipes/blacksmithing.json b/data/mods/Magiclysm/recipes/blacksmithing.json index bacd132e6b72e..df26a8995fd4a 100644 --- a/data/mods/Magiclysm/recipes/blacksmithing.json +++ b/data/mods/Magiclysm/recipes/blacksmithing.json @@ -25,6 +25,7 @@ "type": "recipe", "activity_level": "fake", "category": "CC_OTHER", + "subcategory": "CSC_OTHER_MATERIALS", "skill_used": "fabrication", "difficulty": 5, "time": "180 m", diff --git a/src/recipe.cpp b/src/recipe.cpp index 390268829fc75..7994e1808c04e 100644 --- a/src/recipe.cpp +++ b/src/recipe.cpp @@ -309,8 +309,8 @@ void recipe::load( const JsonObject &jo, const std::string &src ) if( type == "recipe" ) { - assign( jo, "category", category, strict ); - assign( jo, "subcategory", subcategory, strict ); + mandatory( jo, was_loaded, "category", category ); + mandatory( jo, was_loaded, "subcategory", subcategory ); assign( jo, "description", description, strict ); assign( jo, "reversible", reversible, strict ); @@ -377,10 +377,10 @@ void recipe::load( const JsonObject &jo, const std::string &src ) } } else if( type == "practice" ) { mandatory( jo, false, "name", name_ ); - assign( jo, "category", category, strict ); - assign( jo, "subcategory", subcategory, strict ); + mandatory( jo, was_loaded, "category", category ); + mandatory( jo, was_loaded, "subcategory", subcategory ); assign( jo, "description", description, strict ); - mandatory( jo, false, "practice_data", practice_data ); + mandatory( jo, was_loaded, "practice_data", practice_data ); if( jo.has_member( "byproducts" ) ) { byproducts.clear(); diff --git a/src/recipe.h b/src/recipe.h index f11386fce2378..232948f6ec06f 100644 --- a/src/recipe.h +++ b/src/recipe.h @@ -107,6 +107,7 @@ class recipe return result_; } + bool was_loaded = false; bool obsolete = false; std::string category; diff --git a/src/recipe_dictionary.cpp b/src/recipe_dictionary.cpp index e192b5d4d6d91..0ef2eda0d3e0c 100644 --- a/src/recipe_dictionary.cpp +++ b/src/recipe_dictionary.cpp @@ -404,6 +404,7 @@ recipe &recipe_dictionary::load( const JsonObject &jo, const std::string &src, } r.load( jo, src ); + r.was_loaded = true; return out[ r.ident() ] = std::move( r ); }