From 1cdac362ff05803837d493c2bcc0bfad5a547352 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 08:19:07 -0500 Subject: [PATCH] refactor(component): an object's starting inventory loads in LoadDataFromTemplate Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/InventoryComponent.cpp | 9 +++++++-- dGame/dComponents/InventoryComponent.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 6a436ff62..4090b1019 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -108,9 +108,14 @@ InventoryComponent::InventoryComponent(Entity* parent, const int32_t componentID if (character) LoadXml(character->GetXMLDoc()); CheckProxyIntegrity(); - - return; } +} + +// An object's starting inventory from the InventoryComponent rows, with the equipped items (a character's comes from +// its save instead) +void InventoryComponent::LoadDataFromTemplate() { + const auto lot = m_Parent->GetLOT(); + if (lot == 1) return; auto* compRegistryTable = CDClientManager::GetTable(); const auto componentId = compRegistryTable->GetByIDAndType(lot, eReplicaComponentType::INVENTORY); diff --git a/dGame/dComponents/InventoryComponent.h b/dGame/dComponents/InventoryComponent.h index 231de8ea9..aea57a8a2 100644 --- a/dGame/dComponents/InventoryComponent.h +++ b/dGame/dComponents/InventoryComponent.h @@ -101,6 +101,8 @@ public: static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY; InventoryComponent(Entity* parent, const int32_t componentID); + void LoadDataFromTemplate() override; + void Run(float deltaTime) override; void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override; void LoadXml(const tinyxml2::XMLDocument& document);