From a538f32382b60986cc1f25beb44ca68e2d8e3e3c Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 2 Oct 2026 10:33:30 -0500 Subject: [PATCH] fix(inventory): the charxml's items element has nn="1", as live Live charxmls carried (225 of 226 captured). LWOInventoryComponent_Common::LoadFromSaveData (0x00d1ec40) reads it and then does not add the inventory component's template items to the loaded character. No effect on players today (the player LOT's inventory component has no items); the server never wrote it. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/InventoryComponent.cpp | 3 +++ tests/dGameTests/dComponentsTests/InventorySaveTests.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index ff6e17179..74fd6033c 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -860,6 +860,9 @@ void InventoryComponent::WriteSaveData(tinyxml2::XMLDocument& document) { } items->DeleteChildren(); + // As live wrote it (225 of 226 captured charxmls): LWOInventoryComponent_Common::LoadFromSaveData (0x00d1ec40) then + // doesn't add the inventory component's template items to a loaded character + items->SetAttribute("nn", 1); // Saved while the equipped items are pushed (build mode, possibly carrying a model): the character's equipment is // the pushed state, which PopEquippedItems puts back, not the temporary items equipped since. diff --git a/tests/dGameTests/dComponentsTests/InventorySaveTests.cpp b/tests/dGameTests/dComponentsTests/InventorySaveTests.cpp index 9868a6d45..83d9d543a 100644 --- a/tests/dGameTests/dComponentsTests/InventorySaveTests.cpp +++ b/tests/dGameTests/dComponentsTests/InventorySaveTests.cpp @@ -93,3 +93,9 @@ TEST_F(InventorySaveTests, ItemTakenOffInBuildModeIsStillSavedEquipped) { EXPECT_TRUE(SavedEquipped(hat->GetId())); } + +// Live charxmls have +TEST_F(InventorySaveTests, ItemsAreSavedWithNn) { + inventory->WriteSaveData(doc); + EXPECT_STREQ(doc.FirstChildElement("obj")->FirstChildElement("inv")->FirstChildElement("items")->Attribute("nn"), "1"); +}