Skip to content

Commit

Permalink
Read ids and save ids for enchantments (#38262)
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT authored and ZhilkinSerg committed Apr 2, 2020
1 parent 2a64a62 commit 03365cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<has>( active_conditions.first ) );
jsout.member( "condition", io::enum_to_string<condition>( active_conditions.second ) );

Expand Down
3 changes: 3 additions & 0 deletions src/relic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
Expand Down

0 comments on commit 03365cd

Please sign in to comment.