From 676098dc5f767f9428dc85b384d02015fa782695 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 31 Aug 2022 19:56:09 +0300 Subject: [PATCH] Fix weapon safety check --- src/combat_ai.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/combat_ai.cc b/src/combat_ai.cc index 7c8c0cf..61ebad3 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -2526,7 +2526,9 @@ static int _ai_try_attack(Object* a1, Object* a2) || (critterGetBodyType(a2) == BODY_TYPE_BIPED && ((a2->fid & 0xF000) >> 12 == 0) && artExists(buildFid(OBJ_TYPE_CRITTER, a1->fid & 0xFFF, ANIM_THROW_PUNCH, 0, a1->rotation + 1)))) { - if (_combat_safety_invalidate_weapon(a1, weapon, HIT_MODE_RIGHT_WEAPON_PRIMARY, a2, &v31)) { + // SFALL: Check the safety of weapons based on the selected attack mode + // instead of always the primary weapon hit mode. + if (_combat_safety_invalidate_weapon(a1, weapon, hitMode, a2, &v31)) { _ai_switch_weapons(a1, &hitMode, &weapon, a2); } } else {