Skip to content

Commit

Permalink
fix function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT committed Oct 18, 2019
1 parent f5995ae commit 3d11974
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 117 deletions.
30 changes: 15 additions & 15 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ void player::bionics_uninstall_failure( int difficulty, int success, float adjus
add_msg( m_neutral, _( "The removal is a failure." ) );
switch( fail_type ) {
case 1:
if( !has_trait( trait_id( "NOPAIN" ) ) ) {
if( !mutations.has_trait( trait_id( "NOPAIN" ) ) ) {
add_msg_if_player( m_bad, _( "It really hurts!" ) );
mod_pain( rng( failure_level * 3, failure_level * 6 ) );
}
Expand Down Expand Up @@ -1177,7 +1177,7 @@ void player::bionics_uninstall_failure( monster &installer, player &patient, int
}
switch( fail_type ) {
case 1:
if( !has_trait( trait_id( "NOPAIN" ) ) ) {
if( !mutations.has_trait( trait_id( "NOPAIN" ) ) ) {
patient.add_msg_if_player( m_bad, _( "It really hurts!" ) );
patient.mod_pain( rng( failure_level * 3, failure_level * 6 ) );
}
Expand Down Expand Up @@ -1219,8 +1219,8 @@ bool player::has_enough_anesth( const itype *cbm, player &patient )
return false;
}

if( has_bionic( bionic_id( "bio_painkiller" ) ) || has_trait( trait_NOPAIN ) ||
has_trait( trait_id( "DEBUG_BIONICS" ) ) ) {
if( has_bionic( bionic_id( "bio_painkiller" ) ) || mutations.has_trait( trait_NOPAIN ) ||
mutations.has_trait( trait_id( "DEBUG_BIONICS" ) ) ) {
return true;
}

Expand Down Expand Up @@ -1266,14 +1266,14 @@ int player::bionics_pl_skill( const skill_id &most_important_skill, const skill_
}

// Medical residents have some idea what they're doing
if( has_trait( trait_PROF_MED ) ) {
if( mutations.has_trait( trait_PROF_MED ) ) {
pl_skill += 3;
add_msg_player_or_npc( m_neutral, _( "You prep to begin surgery." ),
_( "<npcname> prepares for surgery." ) );
}

// People trained in bionics gain an additional advantage towards using it
if( has_trait( trait_PROF_AUTODOC ) ) {
if( mutations.has_trait( trait_PROF_AUTODOC ) ) {
pl_skill += 7;
add_msg( m_neutral, _( "A lifetime of augmentation has taught %s a thing or two..." ),
disp_name() );
Expand All @@ -1285,7 +1285,7 @@ int player::bionics_pl_skill( const skill_id &most_important_skill, const skill_
int bionic_manip_cos( float adjusted_skill, bool autodoc, int bionic_difficulty )
{
if( ( autodoc && get_option < bool > ( "SAFE_AUTODOC" ) ) ||
g->u.has_trait( trait_id( "DEBUG_BIONICS" ) ) ) {
g->u.mutations.has_trait( trait_id( "DEBUG_BIONICS" ) ) ) {
return 100;
}

Expand Down Expand Up @@ -1698,7 +1698,7 @@ bool player::install_bionics( const itype &type, player &installer, bool autodoc
activity.str_values.push_back( "" );
activity.str_values.push_back( "" );
}
if( installer.has_trait( trait_PROF_MED ) || installer.has_trait( trait_PROF_AUTODOC ) ) {
if( installer.mutations.has_trait( trait_PROF_MED ) || installer.mutations.has_trait( trait_PROF_AUTODOC ) ) {
activity.str_values.push_back( installer.disp_name( true ) );
} else {
activity.str_values.push_back( "NOT_MED" );
Expand All @@ -1713,7 +1713,7 @@ bool player::install_bionics( const itype &type, player &installer, bool autodoc
add_effect( effect_under_op, difficulty * 20_minutes, elem.first, true, difficulty );
}
for( const trait_id &mid : bioid->canceled_mutations ) {
if( has_trait( mid ) ) {
if( mutations.has_trait( mid ) ) {
activity.str_values.push_back( mid.c_str() );
}
}
Expand All @@ -1740,7 +1740,7 @@ void player::perform_install( bionic_id bid, bionic_id upbid, int difficulty, in

if( !trait_to_rem.empty() ) {
for( trait_id tid : trait_to_rem ) {
remove_mutation( tid );
mutations.remove_mutation( *this, tid );
}
}

Expand Down Expand Up @@ -1790,7 +1790,7 @@ void player::bionics_install_failure( bionic_id bid, std::string installer, int
switch( fail_type ) {

case 1:
if( !( has_trait( trait_id( "NOPAIN" ) ) ) ) {
if( !( mutations.has_trait( trait_id( "NOPAIN" ) ) ) ) {
add_msg_if_player( m_bad, _( "It really hurts!" ) );
mod_pain( rng( failure_level * 3, failure_level * 6 ) );
}
Expand Down Expand Up @@ -2273,7 +2273,7 @@ void player::introduce_into_anesthesia( const time_duration &duration, player &i
_( "<npcname> settles into position, sliding their wrist into the couch's strap." ) );
if( needs_anesthesia ) {
//post-threshold medical mutants do not fear operations.
if( has_trait( trait_THRESH_MEDICAL ) ) {
if( mutations.has_trait( trait_THRESH_MEDICAL ) ) {
add_msg_if_player( m_mixed,
_( "You feel excited as the operation starts." ) );
}
Expand All @@ -2284,7 +2284,7 @@ void player::introduce_into_anesthesia( const time_duration &duration, player &i
//post-threshold medical mutants with Deadened don't need anesthesia due to their inability to feel pain
} else {
//post-threshold medical mutants do not fear operations.
if( has_trait( trait_THRESH_MEDICAL ) ) {
if( mutations.has_trait( trait_THRESH_MEDICAL ) ) {
add_msg_if_player( m_mixed,
_( "You feel excited as the Autodoc slices painlessly into you. You enjoy the sight of scalpels slicing you apart, but as operation proceeds you suddenly feel tired and pass out." ) );
} else {
Expand All @@ -2294,8 +2294,8 @@ void player::introduce_into_anesthesia( const time_duration &duration, player &i
}

//Pain junkies feel sorry about missed pain from operation.
if( has_trait( trait_MASOCHIST ) || has_trait( trait_MASOCHIST_MED ) ||
has_trait( trait_CENOBITE ) ) {
if( mutations.has_trait( trait_MASOCHIST ) || mutations.has_trait( trait_MASOCHIST_MED ) ||
mutations.has_trait( trait_CENOBITE ) ) {
add_msg_if_player( m_mixed,
_( "As your conciousness slips away, you feel regret that you won't be able to enjoy the operation." ) );
}
Expand Down
26 changes: 13 additions & 13 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,11 @@ static std::string get_freshness_description( const item &food_item )
item::sizing item::get_sizing( const Character &p, bool wearable ) const
{
if( wearable ) {
const bool small = p.has_trait( trait_small2 ) ||
p.has_trait( trait_small_ok );
const bool small = p.mutations.has_trait( trait_small2 ) ||
p.mutations.has_trait( trait_small_ok );

const bool big = p.has_trait( trait_huge ) ||
p.has_trait( trait_huge_ok );
const bool big = p.mutations.has_trait( trait_huge ) ||
p.mutations.has_trait( trait_huge_ok );

// due to the iterative nature of these features, something can fit and be undersized/oversized
// but that is fine because we have separate logic to adjust encumberance per each. One day we
Expand Down Expand Up @@ -1364,7 +1364,7 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
abs( static_cast<int>( food_item->charges ) * batch ) ) );
}
if( food_item->corpse != nullptr && ( debug || ( g != nullptr &&
( g->u.has_bionic( bionic_id( "bio_scent_vision" ) ) || g->u.has_trait( trait_id( "CARNIVORE" ) ) ||
( g->u.has_bionic( bionic_id( "bio_scent_vision" ) ) || g->u.mutations.has_trait( trait_id( "CARNIVORE" ) ) ||
g->u.has_artifact_with( AEP_SUPER_CLAIRVOYANCE ) ) ) )
&& parts->test( iteminfo_parts::FOOD_SMELL ) ) {
info.push_back( iteminfo( "FOOD", _( "Smells like: " ) + food_item->corpse->nname() ) );
Expand All @@ -1389,7 +1389,7 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
}

if( food_item->has_flag( "CANNIBALISM" ) && parts->test( iteminfo_parts::FOOD_CANNIBALISM ) ) {
if( !g->u.has_trait_flag( "CANNIBAL" ) ) {
if( !g->u.mutations.has_trait_flag( "CANNIBAL" ) ) {
info.emplace_back( "DESCRIPTION", _( "* This food contains <bad>human flesh</bad>." ) );
} else {
info.emplace_back( "DESCRIPTION", _( "* This food contains <good>human flesh</good>." ) );
Expand Down Expand Up @@ -1442,7 +1442,7 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
if( g->u.has_bionic( bionic_id( "bio_digestion" ) ) ) {
info.push_back( iteminfo( "DESCRIPTION",
_( "This food has started to <neutral>rot</neutral>, but <info>your bionic digestion can tolerate it</info>." ) ) );
} else if( g->u.has_trait( trait_id( "SAPROVORE" ) ) ) {
} else if( g->u.mutations.has_trait( trait_id( "SAPROVORE" ) ) ) {
info.push_back( iteminfo( "DESCRIPTION",
_( "This food has started to <neutral>rot</neutral>, but <info>you can tolerate it</info>." ) ) );
} else {
Expand Down Expand Up @@ -2568,7 +2568,7 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
insert_separation_line();
}

if( is_armor() && u.has_trait( trait_id( "WOOLALLERGY" ) ) && ( made_of( material_id( "wool" ) ) ||
if( is_armor() && u.mutations.has_trait( trait_id( "WOOLALLERGY" ) ) && ( made_of( material_id( "wool" ) ) ||
item_tags.count( "wooled" ) ) ) {
info.push_back( iteminfo( "DESCRIPTION",
_( "* This clothing will give you an <bad>allergic reaction</bad>." ) ) );
Expand Down Expand Up @@ -3110,7 +3110,7 @@ nc_color item::color_in_inventory() const
ret = c_cyan;
} else if( has_flag( "LITCIG" ) ) {
ret = c_red;
} else if( is_armor() && u.has_trait( trait_id( "WOOLALLERGY" ) ) &&
} else if( is_armor() && u.mutations.has_trait( trait_id( "WOOLALLERGY" ) ) &&
( made_of( material_id( "wool" ) ) || item_tags.count( "wooled" ) ) ) {
ret = c_red;
} else if( is_filthy() || item_tags.count( "DIRTY" ) ) {
Expand Down Expand Up @@ -8289,9 +8289,9 @@ bool item::process_litcig( player *carrier, const tripoint &pos )
// if carried by someone:
if( carrier != nullptr ) {
time_duration duration = 15_seconds;
if( carrier->has_trait( trait_id( "TOLERANCE" ) ) ) {
if( carrier->mutations.has_trait( trait_id( "TOLERANCE" ) ) ) {
duration = 7_seconds;
} else if( carrier->has_trait( trait_id( "LIGHTWEIGHT" ) ) ) {
} else if( carrier->mutations.has_trait( trait_id( "LIGHTWEIGHT" ) ) ) {
duration = 30_seconds;
}
carrier->add_msg_if_player( m_neutral, _( "You take a puff of your %s." ), tname() );
Expand All @@ -8303,7 +8303,7 @@ bool item::process_litcig( player *carrier, const tripoint &pos )
carrier->moves -= 15;

if( ( carrier->has_effect( effect_shakes ) && one_in( 10 ) ) ||
( carrier->has_trait( trait_id( "JITTERY" ) ) && one_in( 200 ) ) ) {
( carrier->mutations.has_trait( trait_id( "JITTERY" ) ) && one_in( 200 ) ) ) {
carrier->add_msg_if_player( m_bad, _( "Your shaking hand causes you to drop your %s." ),
tname() );
g->m.add_item_or_charges( pos + point( rng( -1, 1 ), rng( -1, 1 ) ), *this );
Expand Down Expand Up @@ -8980,7 +8980,7 @@ skill_id item::contextualize_skill( const skill_id &id ) const
bool item::is_filthy() const
{
return has_flag( "FILTHY" ) && ( get_option<bool>( "FILTHY_MORALE" ) ||
g->u.has_trait( trait_id( "SQUEAMISH" ) ) );
g->u.mutations.has_trait( trait_id( "SQUEAMISH" ) ) );
}

bool item::on_drop( const tripoint &pos )
Expand Down
Loading

0 comments on commit 3d11974

Please sign in to comment.