Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leftovers of "ident" #77796

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 5 additions & 25 deletions src/generic_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> &id, int_id<T> &result ) const {
if( id._version == version ) {
Expand Down Expand Up @@ -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<check_plural_t> restore_check_plural( check_plural );
check_plural = check_plural_t::none;
Expand Down Expand Up @@ -292,27 +290,9 @@ class generic_factory
insert( def );
}

} else if( jo.has_string( legacy_id_member_name ) ) {
def.id = string_id<T>( 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<T>( 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 ) );
}
}
/**
Expand Down
3 changes: 1 addition & 2 deletions src/mod_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions src/skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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;
Expand Down
Loading