diff --git a/src/savegame.cpp b/src/savegame.cpp index b063bc4496d4d..507cadf1a24b8 100644 --- a/src/savegame.cpp +++ b/src/savegame.cpp @@ -1585,7 +1585,19 @@ void faction_manager::serialize( JsonOut &jsout ) const void faction_manager::deserialize( JsonIn &jsin ) { - jsin.read( factions ); + jsin.start_array(); + while( !jsin.end_array() ) { + faction add_fac; + jsin.read( add_fac ); + faction *old_fac = get( add_fac.id ); + if( old_fac ) { + *old_fac = add_fac; + // force a revalidation of add_fac + get( add_fac.id ); + } else { + factions.emplace_back( add_fac ); + } + } } void Creature_tracker::deserialize( JsonIn &jsin ) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index a3981409556d4..1d4445a0d0a8c 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -1527,7 +1527,7 @@ void npc::store( JsonOut &json ) const json.member( "previous_mission", previous_mission ); json.member( "faction_api_ver", faction_api_version ); if( !fac_id.str().empty() ) { // set in constructor - json.member( "my_fac", my_fac->id.c_str() ); + json.member( "my_fac", fac_id.c_str() ); } json.member( "attitude", static_cast( attitude ) ); json.member( "previous_attitude", static_cast( attitude ) );