From c5f4b075276caae24698b937ce696c301d93c255 Mon Sep 17 00:00:00 2001 From: Brett Dong Date: Tue, 1 Dec 2020 02:13:17 +0800 Subject: [PATCH] Fixed compile errors --- src/character.cpp | 17 +++++++++++------ src/character.h | 4 +++- src/monattack.cpp | 6 +----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 4f6d8983244ad..4e2b92efe91fa 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -120,6 +120,11 @@ static const bionic_id bio_eye_optic( "bio_eye_optic" ); static const bionic_id bio_soporific( "bio_soporific" ); static const bionic_id bio_uncanny_dodge( "bio_uncanny_dodge" ); static const bionic_id bio_watch( "bio_watch" ); +static const bionic_id bio_armor_arms( "bio_armor_arms" ); +static const bionic_id bio_armor_legs( "bio_armor_legs" ); +static const bionic_id bio_armor_head( "bio_armor_head" ); +static const bionic_id bio_armor_torso( "bio_armor_torso" ); + static const efftype_id effect_adrenaline( "adrenaline" ); static const efftype_id effect_alarm_clock( "alarm_clock" ); @@ -1493,10 +1498,10 @@ bool Character::can_run() const bool Character::is_bp_armored( const bodypart_id &bp ) const { - return ( bp == bp_torso && has_bionic( bio_armor_torso ) ) || \ - ( bp == bp_head && has_bionic( bio_armor_head ) ) || \ - ( ( bp == bp_arm_l || bp == bp_arm_r ) && has_bionic( bio_armor_arms ) ) || \ - ( ( bp == bp_leg_l || bp == bp_leg_r ) && has_bionic( bio_armor_arms ) ); + return ( bp->token == bp_torso && has_bionic( bio_armor_torso ) ) || \ + ( bp->token == bp_head && has_bionic( bio_armor_head ) ) || \ + ( ( bp->token == bp_arm_l || bp->token == bp_arm_r ) && has_bionic( bio_armor_arms ) ) || \ + ( ( bp->token == bp_leg_l || bp->token == bp_leg_r ) && has_bionic( bio_armor_legs ) ); } void Character::try_remove_downed() @@ -8333,7 +8338,7 @@ int Character::get_armor_fire_base( bodypart_id bp ) const } } - ret += mutation_armor( bp, damage_type::heat ); + ret += mutation_armor( bp, damage_type::HEAT ); return ret; } @@ -8353,7 +8358,7 @@ int Character::get_armor_acid_base( bodypart_id bp ) const } } - ret += mutation_armor( bp, damage_type::acid ); + ret += mutation_armor( bp, damage_type::ACID ); return ret; } diff --git a/src/character.h b/src/character.h index ecde60bc86ee7..a4d8510bfd5bc 100644 --- a/src/character.h +++ b/src/character.h @@ -990,8 +990,10 @@ class Character : public Creature, public visitable bool is_limb_broken( const bodypart_id &limb ) const; /** source of truth of whether a Character can run */ bool can_run() const; - /** Hurts all body parts for dam, no armor reduction */ + bool is_bp_armored( const bodypart_id &bp ) const; + + /** Hurts all body parts for dam, no armor reduction */ void hurtall( int dam, Creature *source, bool disturb = true ); /** Harms all body parts for dam, with armor reduction. If vary > 0 damage to parts are random within vary % (1-100) */ int hitall( int dam, int vary, Creature *source ); diff --git a/src/monattack.cpp b/src/monattack.cpp index db6c2ab9188dd..ee78ab4dc0c63 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -209,10 +209,6 @@ static const mtype_id mon_zombie_jackson( "mon_zombie_jackson" ); static const mtype_id mon_zombie_skeltal_minion( "mon_zombie_skeltal_minion" ); static const bionic_id bio_uncanny_dodge( "bio_uncanny_dodge" ); -static const bionic_id bio_armor_arms( "bio_armor_arms" ); -static const bionic_id bio_armor_legs( "bio_armor_legs" ); -static const bionic_id bio_armor_head( "bio_armor_head" ); -static const bionic_id bio_armor_torso( "bio_armor_torso" ); // shared utility functions static bool within_visual_range( monster *z, int max_range ) @@ -4159,7 +4155,7 @@ bool mattack::stretch_bite( monster *z ) z->name(), body_part_name_accusative( hit ) ); - if( one_in( 16 - dam ) && ( ( target->is_avatar() || target->is_npc() ) && target->as_character()->is_bp_armored( hit ) ? !one_in( 4 ) : true ) { + if( one_in( 16 - dam ) && ( ( target->is_avatar() || target->is_npc() ) && target->as_character()->is_bp_armored( hit ) ? !one_in( 4 ) : true ) ) { if( target->has_effect( effect_bite, hit.id() ) ) { target->add_effect( effect_bite, 40_minutes, hit, true ); } else if( target->has_effect( effect_infected, hit.id() ) ) {