From 55c1b014fdb71320eed3afe2021cfa1a749b3110 Mon Sep 17 00:00:00 2001 From: bogu Date: Mon, 1 Jan 2024 10:50:30 +0100 Subject: [PATCH 1/2] Check if lastActiveMunition is dangled --- zUtilities/Inventory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zUtilities/Inventory.cpp b/zUtilities/Inventory.cpp index e326090..c689098 100644 --- a/zUtilities/Inventory.cpp +++ b/zUtilities/Inventory.cpp @@ -35,6 +35,14 @@ namespace GOTHIC_ENGINE { if ( !Options::ActivateUsedMunition ) return; + if (lastActiveMunition) { + if (player->inventory2.IsIn(lastActiveMunition, 1) == nullptr + && player->GetLeftHand() != lastActiveMunition + && player->GetRightHand() != lastActiveMunition) { + lastActiveMunition = nullptr; + } + } + if ( playerStatus.traderNpc ) { HandleMunition( nullptr ); return; From bd4924fd950b53fd58f1467c541547859787022a Mon Sep 17 00:00:00 2001 From: bogu Date: Mon, 1 Jan 2024 10:52:28 +0100 Subject: [PATCH 2/2] Handle munition only if inventory is open --- zUtilities/Inventory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zUtilities/Inventory.cpp b/zUtilities/Inventory.cpp index c689098..512cb67 100644 --- a/zUtilities/Inventory.cpp +++ b/zUtilities/Inventory.cpp @@ -35,6 +35,9 @@ namespace GOTHIC_ENGINE { if ( !Options::ActivateUsedMunition ) return; + if (!player->inventory2.IsOpen()) + return; + if (lastActiveMunition) { if (player->inventory2.IsIn(lastActiveMunition, 1) == nullptr && player->GetLeftHand() != lastActiveMunition @@ -48,9 +51,6 @@ namespace GOTHIC_ENGINE { return; } - if ( !player->inventory2.IsOpen() ) - return; - oCItem* weapon = player->GetEquippedRangedWeapon(); if ( !weapon ) weapon = player->GetWeapon();