Skip to content

Commit

Permalink
Update deserialization
Browse files Browse the repository at this point in the history
cbm_weapon_index defaults to -1 in legacy saves when empty
  • Loading branch information
KheirFerrum committed Apr 26, 2023
1 parent 851a5f1 commit 1bdc7ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,9 @@ void npc::load( const JsonObject &data )
if( data.has_member( "cbm_weapon_index" ) ) {
int index = 0;
data.read( "cbm_weapon_index", index );
cbm_toggled = ( *my_bionics )[ index ].id;
if( index >= 0 ) {
cbm_toggled = ( *my_bionics )[ index ].id;
}
}
cbm_active = bionic_id::NULL_ID();
data.read( "cbm_active", cbm_active );
Expand Down

0 comments on commit 1bdc7ae

Please sign in to comment.