diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index 205c9195..aa78289e 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -331,12 +331,10 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) { if (m_ClaimCodes[2] != 0) character->SetAttribute("co2", m_ClaimCodes[2]); if (m_ClaimCodes[3] != 0) character->SetAttribute("co3", m_ClaimCodes[3]); - // Tests have been written up to here - character->SetAttribute("ls", m_Uscore); // Custom attribute to keep track of reputation. character->SetAttribute("rpt", GetReputation()); - character->SetAttribute("stt", StatisticsToString().c_str()); // and also this already tested :) + character->SetAttribute("stt", StatisticsToString().c_str()); // Set the zone statistics of the form ... auto zoneStatistics = character->FirstChildElement("zs"); @@ -358,6 +356,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) { character->LinkEndChild(zoneStatistics); + // Tests have been written up to here if (!m_LastRocketConfig.empty()) { std::string config = GeneralUtils::UTF16ToWTF8(m_LastRocketConfig); character->SetAttribute("lcbp", config.c_str()); diff --git a/tests/dGameTests/dComponentsTests/SavingTests.cpp b/tests/dGameTests/dComponentsTests/SavingTests.cpp index 972499f8..bfc6c4fb 100644 --- a/tests/dGameTests/dComponentsTests/SavingTests.cpp +++ b/tests/dGameTests/dComponentsTests/SavingTests.cpp @@ -69,11 +69,14 @@ TEST_F(SavingTest, CharacterComponentTest) { const auto rightHandPrev = characterComponent->m_Character->GetRightHand(); const auto shirtColorPrev = characterComponent->m_Character->GetShirtColor(); const auto zoneStatsPrev = characterComponent->GetZoneStatistics(); + const auto uscorePrev = characterComponent->GetUScore(); + const auto reputationPrev = characterComponent->GetReputation(); // Update the xml document so its been run through the saver character->SaveXMLToDatabase(); - // Reload the component from the now updated xml data + // Reload the component and character from the now updated xml data + character->_doQuickXMLDataParse(); characterComponent = entity->AddComponent(character.get(), UNASSIGNED_SYSTEM_ADDRESS); characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc()); @@ -104,6 +107,8 @@ TEST_F(SavingTest, CharacterComponentTest) { }; ASSERT_EQ(correctZoneStats, characterComponent->GetZoneStatistics()); + ASSERT_EQ(7510, characterComponent->GetUScore()); + ASSERT_EQ(300, characterComponent->GetReputation()); // Fails currently due to not reading style from xml // Should the value be fixed, this test will fail and will match the above