From 8eb4ad58a4b6ba24a6601457202adb3c3b8145cd Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:11:00 -0500 Subject: [PATCH] Remove leftovers of "ident" --- src/generic_factory.h | 30 +++++------------------------- src/mod_manager.cpp | 3 +-- src/skill.cpp | 9 ++------- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/src/generic_factory.h b/src/generic_factory.h index b4850bf88d31c..f792c8b4a0e89 100644 --- a/src/generic_factory.h +++ b/src/generic_factory.h @@ -143,8 +143,6 @@ class generic_factory std::string type_name; std::string id_member_name; - // TEMPORARY until 0.G: Remove "ident" support - const std::string legacy_id_member_name = "ident"; bool find_id( const string_id &id, int_id &result ) const { if( id._version == version ) { @@ -243,9 +241,9 @@ class generic_factory } if( jo.has_string( abstract_member_name ) ) { - if( jo.has_string( id_member_name ) || jo.has_string( legacy_id_member_name ) ) { - jo.throw_error( string_format( "cannot specify both '%s' and '%s'/'%s'", - abstract_member_name, id_member_name, legacy_id_member_name ) ); + if( jo.has_string( id_member_name ) ) { + jo.throw_error( string_format( "cannot specify both '%s' and '%s'", + abstract_member_name, id_member_name ) ); } restore_on_out_of_scope restore_check_plural( check_plural ); check_plural = check_plural_t::none; @@ -292,27 +290,9 @@ class generic_factory insert( def ); } - } else if( jo.has_string( legacy_id_member_name ) ) { - def.id = string_id( jo.get_string( legacy_id_member_name ) ); - mod_tracker::assign_src( def, src ); - def.load( jo, src ); - insert( def ); - - } else if( jo.has_array( legacy_id_member_name ) ) { - for( const JsonValue e : jo.get_array( legacy_id_member_name ) ) { - T def; - if( !handle_inheritance( def, jo, src ) ) { - break; - } - def.id = string_id( e ); - mod_tracker::assign_src( def, src ); - def.load( jo, src ); - insert( def ); - } - } else if( !jo.has_string( abstract_member_name ) ) { - jo.throw_error( string_format( "must specify either '%s' or '%s'/'%s'", - abstract_member_name, id_member_name, legacy_id_member_name ) ); + jo.throw_error( string_format( "must specify either '%s' or '%s'", + abstract_member_name, id_member_name ) ); } } /** diff --git a/src/mod_manager.cpp b/src/mod_manager.cpp index a7cd1f837aa91..0bbd2848cebc0 100644 --- a/src/mod_manager.cpp +++ b/src/mod_manager.cpp @@ -226,8 +226,7 @@ void mod_manager::load_modfile( const JsonObject &jo, const cata_path &path ) return; } - // TEMPORARY until 0.G: Remove "ident" support - const mod_id m_ident( jo.has_string( "ident" ) ? jo.get_string( "ident" ) : jo.get_string( "id" ) ); + const mod_id m_ident( jo.get_string( "id" ) ); // can't use string_id::is_valid as the global mod_manger instance does not exist yet if( mod_map.count( m_ident ) > 0 ) { // TODO: change this to make unique ident for the mod diff --git a/src/skill.cpp b/src/skill.cpp index e56b6ecc3a846..8847093c8a145 100644 --- a/src/skill.cpp +++ b/src/skill.cpp @@ -116,9 +116,7 @@ void Skill::reset() void Skill::load_skill( const JsonObject &jsobj ) { - // TEMPORARY until 0.G: Remove "ident" support - skill_id ident = skill_id( jsobj.has_string( "ident" ) ? jsobj.get_string( "ident" ) : - jsobj.get_string( "id" ) ); + skill_id ident = skill_id( jsobj.get_string( "id" ) ); skills.erase( std::remove_if( begin( skills ), end( skills ), [&]( const Skill & s ) { return s._ident == ident; } ), end( skills ) ); @@ -188,10 +186,7 @@ const SkillDisplayType &skill_displayType_id::obj() const void SkillDisplayType::load( const JsonObject &jsobj ) { - // TEMPORARY until 0.G: Remove "ident" support - skill_displayType_id ident = skill_displayType_id( - jsobj.has_string( "ident" ) ? jsobj.get_string( "ident" ) : - jsobj.get_string( "id" ) ); + skill_displayType_id ident = skill_displayType_id( jsobj.get_string( "id" ) ); skillTypes.erase( std::remove_if( begin( skillTypes ), end( skillTypes ), [&]( const SkillDisplayType & s ) { return s._ident == ident;