diff --git a/src/mutation_data.cpp b/src/mutation_data.cpp index bd3750e81e631..a0c3d39a1a25e 100644 --- a/src/mutation_data.cpp +++ b/src/mutation_data.cpp @@ -650,6 +650,8 @@ void mutation_branch::check_consistency() { for( const mutation_branch &mdata : get_all() ) { const trait_id &mid = mdata.id; + const mod_id &trait_source = mdata.src.back().second; + const bool basegame_trait = trait_source.str() == "dda"; const std::optional &s_id = mdata.scent_typeid; const std::map &an_id = mdata.anger_relations; for( const auto &style : mdata.initial_ma_styles ) { @@ -676,10 +678,13 @@ void mutation_branch::check_consistency() if( s_id && !s_id.value().is_valid() ) { debugmsg( "mutation %s refers to undefined scent type %s", mid.c_str(), s_id.value().c_str() ); } + // Suppress these onload warnings for overlapping mods for( const trait_id &replacement : mdata.replacements ) { const mutation_branch &rdata = replacement.obj(); + bool suppressed = rdata.src.back().second != trait_source && !basegame_trait; for( const mutation_category_id &cat : rdata.category ) { - if( std::find( mdata.category.begin(), mdata.category.end(), cat ) == mdata.category.end() ) { + if( std::find( mdata.category.begin(), mdata.category.end(), cat ) == mdata.category.end() && + !suppressed ) { debugmsg( "mutation %s lacks category %s present in replacement mutation %s", mid.c_str(), cat.c_str(), replacement.c_str() ); } @@ -691,27 +696,28 @@ void mutation_branch::check_consistency() } const mutation_branch &adata = addition.obj(); bool found = false; + bool suppressed = adata.src.back().second != trait_source && !basegame_trait; for( const mutation_category_id &cat : adata.category ) { found = found || std::find( mdata.category.begin(), mdata.category.end(), cat ) != mdata.category.end(); } - if( !found ) { + if( !found && !suppressed ) { debugmsg( "categories in mutation %s don't match any category present in additive mutation %s", mid.c_str(), addition.c_str() ); } } - // Suppress this check for trait/prereq combos from different mod sources for( const mutation_category_id &cat_id : mdata.category ) { if( !mdata.prereqs.empty() ) { bool found = false; + bool suppressed = false; for( const trait_id &prereq_id : mdata.prereqs ) { const mutation_branch &prereq = prereq_id.obj(); + suppressed = suppressed || ( prereq.src.back().second != trait_source && !basegame_trait ); found = found || - std::find( prereq.category.begin(), prereq.category.end(), cat_id ) != prereq.category.end() || - mdata.src.end()->second != prereq.src.end()->second; + std::find( prereq.category.begin(), prereq.category.end(), cat_id ) != prereq.category.end(); } - if( !found ) { + if( !found && !suppressed ) { debugmsg( "mutation %s is in category %s but none of its slot 1 prereqs have this category", mid.c_str(), cat_id.c_str() ); } @@ -719,13 +725,14 @@ void mutation_branch::check_consistency() if( !mdata.prereqs2.empty() ) { bool found = false; + bool suppressed = false; for( const trait_id &prereq_id : mdata.prereqs2 ) { const mutation_branch &prereq = prereq_id.obj(); + suppressed = suppressed || ( prereq.src.back().second != trait_source && !basegame_trait ); found = found || - std::find( prereq.category.begin(), prereq.category.end(), cat_id ) != prereq.category.end() || - mdata.src.end()->second != prereq.src.end()->second; + std::find( prereq.category.begin(), prereq.category.end(), cat_id ) != prereq.category.end(); } - if( !found ) { + if( !found && !suppressed ) { debugmsg( "mutation %s is in category %s but none of its slot 2 prereqs have this category", mid.c_str(), cat_id.c_str() ); }