fix(inventory): the charxml's items element has nn="1", as live

Live charxmls carried <items nn="1"> (225 of 226 captured).
LWOInventoryComponent_Common::LoadFromSaveData 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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 10:33:30 -05:00
parent 644e2d9be8
commit 6974198fad
2 changed files with 9 additions and 0 deletions

View File

@@ -860,6 +860,9 @@ void InventoryComponent::WriteSaveData(tinyxml2::XMLDocument& document) {
}
items->DeleteChildren();
// As live wrote it (225 of 226 captured charxmls): LWOInventoryComponent_Common::LoadFromSaveData 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.

View File

@@ -93,3 +93,9 @@ TEST_F(InventorySaveTests, ItemTakenOffInBuildModeIsStillSavedEquipped) {
EXPECT_TRUE(SavedEquipped(hat->GetId()));
}
// Live charxmls have <items nn="1">
TEST_F(InventorySaveTests, ItemsAreSavedWithNn) {
inventory->WriteSaveData(doc);
EXPECT_STREQ(doc.FirstChildElement("obj")->FirstChildElement("inv")->FirstChildElement("items")->Attribute("nn"), "1");
}