From 33a78353ccf0185a34913003a3a6d96b55bca272 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Sat, 22 Feb 2020 21:54:42 -0500 Subject: [PATCH] Read ids and save ids for enchantments (#38262) --- src/magic_enchantment.cpp | 7 +++++++ src/relic.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 6fb9375ac688c..e095fdd84644d 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -241,6 +241,13 @@ void enchantment::serialize( JsonOut &jsout ) const { jsout.start_object(); + if( !id.is_empty() ) { + jsout.member( "id", id ); + jsout.end_object(); + // if the enchantment has an id then it is defined elsewhere and does not need to be serialized. + return; + } + jsout.member( "has", io::enum_to_string( active_conditions.first ) ); jsout.member( "condition", io::enum_to_string( active_conditions.second ) ); diff --git a/src/relic.cpp b/src/relic.cpp index baeea1cd5e805..72bb8f238d271 100644 --- a/src/relic.cpp +++ b/src/relic.cpp @@ -37,6 +37,9 @@ void relic::load( const JsonObject &jo ) for( JsonObject jobj : jo.get_array( "passive_effects" ) ) { enchantment ench; ench.load( jobj ); + if( !ench.id.is_empty() ) { + ench = ench.id.obj(); + } add_passive_effect( ench ); } }