Skip to content

Commit

Permalink
Merge pull request #27 from bogu9821/MunitionFix
Browse files Browse the repository at this point in the history
Munition dangled pointer fix
  • Loading branch information
Franisz authored Jan 1, 2024
2 parents f807388 + bd4924f commit a2fa449
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions zUtilities/Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ namespace GOTHIC_ENGINE {
if ( !Options::ActivateUsedMunition )
return;

if (!player->inventory2.IsOpen())
return;

if (lastActiveMunition) {
if (player->inventory2.IsIn(lastActiveMunition, 1) == nullptr
&& player->GetLeftHand() != lastActiveMunition
&& player->GetRightHand() != lastActiveMunition) {
lastActiveMunition = nullptr;
}
}

if ( playerStatus.traderNpc ) {
HandleMunition( nullptr );
return;
}

if ( !player->inventory2.IsOpen() )
return;

oCItem* weapon = player->GetEquippedRangedWeapon();

if ( !weapon ) weapon = player->GetWeapon();
Expand Down

0 comments on commit a2fa449

Please sign in to comment.