From f80a26a9448c661453b353d38fe5fe8480b8ed30 Mon Sep 17 00:00:00 2001 From: eddytronpie <55319774+PyEddy@users.noreply.github.com> Date: Sat, 30 Jul 2022 04:41:14 +0100 Subject: [PATCH] Fix integer issue with BricksCollected (#679) This fixes an issue where BricksCollected goes to an insane number after selling more bricks than you collected in the area --- dGame/dComponents/CharacterComponent.cpp | 3 ++- dGame/dComponents/CharacterComponent.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index 91666014..3b4b8db8 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -211,7 +211,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) { ZoneStatistics statistics = {}; child->QueryUnsigned64Attribute("ac", &statistics.m_AchievementsCollected); - child->QueryUnsigned64Attribute("bc", &statistics.m_BricksCollected); + child->QueryInt64Attribute("bc", &statistics.m_BricksCollected); child->QueryUnsigned64Attribute("cc", &statistics.m_CoinsCollected); child->QueryUnsigned64Attribute("es", &statistics.m_EnemiesSmashed); child->QueryUnsigned64Attribute("qbc", &statistics.m_QuickBuildsCompleted); @@ -226,6 +226,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) { } const tinyxml2::XMLAttribute* rocketConfig = character->FindAttribute("lcbp"); + if (rocketConfig) { m_LastRocketConfig = GeneralUtils::ASCIIToUTF16(std::string(rocketConfig->Value())); } else { diff --git a/dGame/dComponents/CharacterComponent.h b/dGame/dComponents/CharacterComponent.h index f6bf1e70..8efb4ef5 100644 --- a/dGame/dComponents/CharacterComponent.h +++ b/dGame/dComponents/CharacterComponent.h @@ -15,7 +15,7 @@ */ struct ZoneStatistics { uint64_t m_AchievementsCollected; - uint64_t m_BricksCollected; + int64_t m_BricksCollected; uint64_t m_CoinsCollected; uint64_t m_EnemiesSmashed; uint64_t m_QuickBuildsCompleted; @@ -431,7 +431,7 @@ private: /** * The total amount of bricks collected by this character */ - uint64_t m_BricksCollected; + int64_t m_BricksCollected; /** * The total amount of entities smashed by this character