diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index aa78289e..d706af9c 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -356,7 +356,6 @@ 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/dGame/dComponents/CharacterComponent.h b/dGame/dComponents/CharacterComponent.h index 48cfc4d1..c8cfa988 100644 --- a/dGame/dComponents/CharacterComponent.h +++ b/dGame/dComponents/CharacterComponent.h @@ -313,6 +313,10 @@ public: const std::map& GetZoneStatistics() const { return m_ZoneStatistics; }; + const std::u16string& GetLastRocketConfig() const { return m_LastRocketConfig; }; + + uint64_t GetTotalTimePlayed() const { return m_TotalTimePlayed; }; + /** * Character info regarding this character, including clothing styles, etc. */ diff --git a/tests/dGameTests/dComponentsTests/SavingTests.cpp b/tests/dGameTests/dComponentsTests/SavingTests.cpp index bfc6c4fb..a8a9b60a 100644 --- a/tests/dGameTests/dComponentsTests/SavingTests.cpp +++ b/tests/dGameTests/dComponentsTests/SavingTests.cpp @@ -32,7 +32,6 @@ protected: character->_doQuickXMLDataParse(); character->LoadXmlRespawnCheckpoints(); - entity->AddComponent()->LoadFromXml(entity->GetCharacter()->GetXMLDoc()); entity->AddComponent(character.get(), UNASSIGNED_SYSTEM_ADDRESS)->LoadFromXml(entity->GetCharacter()->GetXMLDoc()); } @@ -56,28 +55,13 @@ TEST_F(SavingTest, CharacterComponentTest) { auto* characterComponent = entity->GetComponent(); - const auto statsPrev = characterComponent->StatisticsToString(); - const auto claimCodesPrev = characterComponent->GetClaimCodes(); - const auto eyebrowsPrev = characterComponent->m_Character->GetEyebrows(); - const auto eyesPrev = characterComponent->m_Character->GetEyes(); - const auto hairColorPrev = characterComponent->m_Character->GetHairColor(); - const auto hairStylePrev = characterComponent->m_Character->GetHairStyle(); - const auto pantsColorPrev = characterComponent->m_Character->GetPantsColor(); - const auto leftHandPrev = characterComponent->m_Character->GetLeftHand(); - const auto shirtStylePrev = characterComponent->m_Character->GetShirtStyle(); - const auto mouthPrev = characterComponent->m_Character->GetMouth(); - 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 and character from the now updated xml data + const auto prevTotalTime = characterComponent->GetTotalTimePlayed(); character->_doQuickXMLDataParse(); - characterComponent = entity->AddComponent(character.get(), UNASSIGNED_SYSTEM_ADDRESS); + entity->AddComponent(character.get(), UNASSIGNED_SYSTEM_ADDRESS); characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc()); // Check that the buff component is the same as before which means resaving data and loading it back in didn't change anything @@ -114,6 +98,8 @@ TEST_F(SavingTest, CharacterComponentTest) { // Should the value be fixed, this test will fail and will match the above // only then will this comment be removed. ASSERT_NE(27, characterComponent->m_Character->GetShirtStyle()); + ASSERT_EQ(u"0:1:4719+1:4720+1:4721", characterComponent->GetLastRocketConfig()); + ASSERT_EQ(prevTotalTime, characterComponent->GetTotalTimePlayed()); // character->GetXMLDoc().Print(&printer); // std::string xmlDataModified(printer.CStr()); diff --git a/tests/dGameTests/dComponentsTests/TestData/test_xml_data.xml b/tests/dGameTests/dComponentsTests/TestData/test_xml_data.xml index 2c83d64a..e37e0e45 100644 --- a/tests/dGameTests/dComponentsTests/TestData/test_xml_data.xml +++ b/tests/dGameTests/dComponentsTests/TestData/test_xml_data.xml @@ -1,6 +1,6 @@ - +