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"); +}