From 5bd69dfee203269022dbea6ea2608ff0fd3d8e35 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Wed, 13 Mar 2019 00:09:46 +0800 Subject: [PATCH] Tweaked the code of the fix in previous commit. --- sfall/Bugs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index 03c2db10..7b2c1777 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -1872,10 +1872,11 @@ static void __declspec(naked) JesseContainerFid() { static void __declspec(naked) ai_search_inven_weap_hook() { __asm { call item_w_subtype_; - cmp eax, 2; // check if subtype <= MELEE - jbe fix; + cmp eax, 3; // check subtype == THROWING + jne fix; retn; fix: + xor eax, eax; mov edx, [esi + 0x40]; test edx, edx; js skip; @@ -2385,6 +2386,6 @@ void BugsInit() // Fix for NPC stuck in a loop of reloading melee/unarmed weapons when out of ammo dlog("Applying fix for NPC stuck in a loop of reloading melee/unarmed weapons.", DL_INIT); - HookCall(0x429A2B , ai_search_inven_weap_hook); + HookCall(0x429A2B, ai_search_inven_weap_hook); dlogr(" Done", DL_INIT); }