From 14716185fbf88962e0576a6e61e1f1fd0e33ceae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:38:58 +0000 Subject: [PATCH] Rename FindBehaviorSlotByEquipLocation to FindBehaviorSlot Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com> --- dGame/dComponents/InventoryComponent.cpp | 6 +++--- dGame/dComponents/InventoryComponent.h | 2 +- .../InventoryComponentTests.cpp | 20 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 2231a680..d4a7a63c 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -1168,7 +1168,7 @@ LOT InventoryComponent::GetConsumable() const { void InventoryComponent::AddItemSkills(const LOT lot) { const auto info = Inventory::FindItemComponent(lot); - const auto slot = FindBehaviorSlotByEquipLocation(info.equipLocation); + const auto slot = FindBehaviorSlot(info.equipLocation); if (slot == BehaviorSlot::Invalid) { return; @@ -1203,7 +1203,7 @@ void InventoryComponent::FixInvisibleItems() { void InventoryComponent::RemoveItemSkills(const LOT lot) { const auto info = Inventory::FindItemComponent(lot); - const auto slot = FindBehaviorSlotByEquipLocation(info.equipLocation); + const auto slot = FindBehaviorSlot(info.equipLocation); if (slot == BehaviorSlot::Invalid) { return; @@ -1315,7 +1315,7 @@ void InventoryComponent::RemoveDatabasePet(LWOOBJID id) { m_Pets.erase(id); } -BehaviorSlot InventoryComponent::FindBehaviorSlotByEquipLocation(const std::string& equipLocation) { +BehaviorSlot InventoryComponent::FindBehaviorSlot(const std::string& equipLocation) { if (equipLocation == "special_r") { return BehaviorSlot::Primary; } else if (equipLocation == "hair") { diff --git a/dGame/dComponents/InventoryComponent.h b/dGame/dComponents/InventoryComponent.h index 7de17dd3..a7e9b21e 100644 --- a/dGame/dComponents/InventoryComponent.h +++ b/dGame/dComponents/InventoryComponent.h @@ -366,7 +366,7 @@ public: * @param equipLocation the equipment location to find the behavior slot for * @return the behavior slot for the given equipment location */ - static BehaviorSlot FindBehaviorSlotByEquipLocation(const std::string& equipLocation); + static BehaviorSlot FindBehaviorSlot(const std::string& equipLocation); /** * Checks if the inventory type is a temp inventory diff --git a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp index fb98e946..5816e616 100644 --- a/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/InventoryComponentTests.cpp @@ -17,18 +17,18 @@ protected: }; /** - * Test that FindBehaviorSlotByEquipLocation correctly maps equipLocation strings to BehaviorSlot enum values + * Test that FindBehaviorSlot correctly maps equipLocation strings to BehaviorSlot enum values */ -TEST_F(InventoryComponentTest, FindBehaviorSlotByEquipLocationTest) { +TEST_F(InventoryComponentTest, FindBehaviorSlotTest) { // Test the mappings from the issue comments - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("special_r"), BehaviorSlot::Primary); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("hair"), BehaviorSlot::Head); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("special_l"), BehaviorSlot::Offhand); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("clavicle"), BehaviorSlot::Neck); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_r"), BehaviorSlot::Primary); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("hair"), BehaviorSlot::Head); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("special_l"), BehaviorSlot::Offhand); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("clavicle"), BehaviorSlot::Neck); // Test that unknown equipLocations return Invalid - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("unknown"), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation(""), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("root"), BehaviorSlot::Invalid); - EXPECT_EQ(InventoryComponent::FindBehaviorSlotByEquipLocation("leftHand"), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("unknown"), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot(""), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("root"), BehaviorSlot::Invalid); + EXPECT_EQ(InventoryComponent::FindBehaviorSlot("leftHand"), BehaviorSlot::Invalid); } \ No newline at end of file