From ddf1af455baa459c9638e53668f0ab9e5b9ed3bf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 May 2012 08:04:58 +0000 Subject: [PATCH] - moved identical damage checks in P_DamageMobj into an inline function. SVN r3650 (trunk) --- src/p_interaction.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 1b596c471..de77f2712 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -879,6 +879,12 @@ void P_AutoUseStrifeHealth (player_t *player) ================== */ +static inline bool MustForcePain(AActor *target, AActor *inflictor) +{ + return (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && + (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)); +} + void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags) { @@ -998,8 +1004,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage source->Inventory->ModifyDamage(olddam, mod, damage, false); if (olddam != damage && damage <= 0) { // Still allow FORCEPAIN - if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && - (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)) + if (MustForcePain(target, inflictor)) { goto dopain; } @@ -1013,8 +1018,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage target->Inventory->ModifyDamage(olddam, mod, damage, true); if (olddam != damage && damage <= 0) { // Still allow FORCEPAIN - if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && - (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)) + if (MustForcePain(target, inflictor)) { goto dopain; } @@ -1031,8 +1035,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } if (damage <= 0) { // Still allow FORCEPAIN - if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && - (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)) + if (MustForcePain(target, inflictor)) { goto dopain; }