From 7bcaa4c17a1966f9460b75aa8499afba122c46ce Mon Sep 17 00:00:00 2001 From: Emilie Schott Date: Tue, 21 Jan 2025 18:21:26 +0100 Subject: [PATCH] Updated ammo in weapon stock adding --- Source/LegumeMix/Private/Player/LMPlayer.cpp | 2 +- Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/LegumeMix/Private/Player/LMPlayer.cpp b/Source/LegumeMix/Private/Player/LMPlayer.cpp index 517a912..b3b65f5 100644 --- a/Source/LegumeMix/Private/Player/LMPlayer.cpp +++ b/Source/LegumeMix/Private/Player/LMPlayer.cpp @@ -35,6 +35,7 @@ void ALMPlayer::PickUpAmmo(ALMAmmo* Ammo) FString AmmoAmount = FString::Printf(TEXT("Quantité de munition : %i"), Ammo->GetAmmoAmount()); GEngine->AddOnScreenDebugMessage(1, 30.f, FColor::Red, AmmoAmount); } + WeaponManager->AddAmmoType(Ammo->GetAmmoType(), Ammo->GetAmmoAmount()); } void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager) @@ -54,7 +55,6 @@ void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager) void ALMPlayer::Tick(float DeltaTime) { Super::Tick(DeltaTime); - } // Called to bind functionality to input diff --git a/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp b/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp index e955737..98613b2 100644 --- a/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp +++ b/Source/LegumeMix/Private/Weapon/LMWeaponManager.cpp @@ -44,8 +44,7 @@ void ULMWeaponManager::AddAmmoType(EAmmoType AmmoType, int AmmoCount) for (const auto Weapon : Weapons) { - // TODO : match weapon ammo type - if (Weapon->WeaponDataStructure.AmmoType == AmmoType) + if (Weapon->WeaponDataStructure.AmmoType != AmmoType) continue; Weapon->AddAmmo(AmmoCount);