From 81af1f382ed34d0f095e8453a3e1fd18a50244e5 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Tue, 17 May 2022 10:18:50 -0500 Subject: [PATCH 1/2] get zones from settings --- .../dComponents/RocketLaunchLupComponent.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/dGame/dComponents/RocketLaunchLupComponent.cpp b/dGame/dComponents/RocketLaunchLupComponent.cpp index fa2a5b16..1c5f71c0 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.cpp +++ b/dGame/dComponents/RocketLaunchLupComponent.cpp @@ -6,16 +6,13 @@ RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(parent) { m_Parent = parent; - - // get the lup worlds from the cdclient - std::string query = "SELECT * FROM LUPZoneIDs;"; - auto results = CDClientDatabase::ExecuteQuery(query); - while (!results.eof()) { - // fallback to 1600 incase there is an issue - m_LUPWorlds.push_back(results.getIntField(0, 1600)); - results.nextRow(); + std::string zoneString = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar(u"MultiZoneIDs")); + std::stringstream ss(zoneString); + for (int i; ss >> i;) { + m_LUPWorlds.push_back(i); + if (ss.peek() == ';') + ss.ignore(); } - results.finalize(); } RocketLaunchLupComponent::~RocketLaunchLupComponent() {} @@ -29,11 +26,7 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) { } void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) { - // Add one to index because the actual LUP worlds start at index 1. - index++; - auto* rocketLaunchpadControlComponent = m_Parent->GetComponent(); - if (!rocketLaunchpadControlComponent) return; rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0); From ca55fccb27722eaf50e8572f300846f5c03e7b14 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Tue, 17 May 2022 10:20:36 -0500 Subject: [PATCH 2/2] remove cdclient include --- dGame/dComponents/RocketLaunchLupComponent.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/dGame/dComponents/RocketLaunchLupComponent.cpp b/dGame/dComponents/RocketLaunchLupComponent.cpp index 1c5f71c0..3c326540 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.cpp +++ b/dGame/dComponents/RocketLaunchLupComponent.cpp @@ -1,5 +1,4 @@ #include "RocketLaunchLupComponent.h" -#include "CDClientDatabase.h" #include "RocketLaunchpadControlComponent.h" #include "InventoryComponent.h" #include "CharacterComponent.h"