Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 076f805

Browse files
committed
Added HeldDevice function IsEmpty for future use
1 parent 4c07418 commit 076f805

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

Entities/HDFirearm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,14 @@ bool HDFirearm::IsFull() const
730730
return true;
731731
}
732732

733+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
734+
735+
bool HDFirearm::IsEmpty() const {
736+
if (m_pMagazine) {
737+
return m_pMagazine->IsEmpty();
738+
}
739+
return true;
740+
}
733741

734742
//////////////////////////////////////////////////////////////////////////////////////////
735743
// Virtual method: Update

Entities/HDFirearm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,8 @@ ClassInfoGetters;
653653

654654
bool IsFull() const override;
655655

656+
bool IsEmpty() const override;
657+
656658

657659
//////////////////////////////////////////////////////////////////////////////////////////
658660
// Method: IsFullAuto

Entities/HeldDevice.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,13 @@ ClassInfoGetters;
529529
// Arguments: None.
530530
// Return value: Whetehr magazine is full or not.
531531

532-
virtual bool IsFull() const { return true; }
532+
virtual bool IsFull() const { return true; }
533+
534+
/// <summary>
535+
/// Tells whether this HeldDevice is currently empty of ammo.
536+
/// </summary>
537+
/// <returns>Whether this HeldDevice is empty.</returns>
538+
virtual bool IsEmpty() const { return false; }
533539

534540

535541
//////////////////////////////////////////////////////////////////////////////////////////

Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ namespace RTE {
667667
.def("DoneReloading", &HeldDevice::DoneReloading)
668668
.def("NeedsReloading", &HeldDevice::NeedsReloading)
669669
.def("IsFull", &HeldDevice::IsFull)
670+
.def("IsEmpty", &HeldDevice::IsEmpty)
670671
.def("IsPickupableBy", &HeldDevice::IsPickupableBy)
671672
.def("AddPickupableByPresetName", &HeldDevice::AddPickupableByPresetName)
672673
.def("RemovePickupableByPresetName", &HeldDevice::RemovePickupableByPresetName);

0 commit comments

Comments
 (0)