Closed mikolaj-pirog closed 2 years ago
Hey, thanks for your submission and welcome to the game. Some of your deductions are slightly incorrect.
First, the note on using _compute_spray
. This function populates extra targets on Attack
struct. The whole purpose of _combat_safety_invalidate_weapon_func
is to check if extra targets contains attackerFriend
, so it's definitely not useless.
The note on objectGetDistanceBetween
is right, but it's not to be fixed, since it's the way the code was written (keep in mind the goal). I have slightly refactored it to remove extra variables which confused you.
collateralDamageToAttacker
is simply wrong. Put it in plain English this function is used to answer these questions:
attacker
, am I going to hit my attackerFriend
? The argument you named collateralDamageToAttacker
is meaningless.attackerFriend
, am I going to be hit by a friend of mine, the attacker
? If yes, how far should I be to avoid damage area? The argument you named collateralDamageToAttacker
contains a distance I need to travel in the opposite direction from defender
.Thanks for a review with explanations & fixes
Name some unnamed vars in combat.c, mostly in the
_combat_safety_invalidate_weapon_func
. Some vars were also named in other functions in more or less random fashion - I was renaming things while trying to understand what vars in_combat_safety_invalidate_weapon_func
do. Added some FIXME around redundant code - I hope this is the right use case.