diff --git a/dGame/dComponents/RocketLaunchLupComponent.cpp b/dGame/dComponents/RocketLaunchLupComponent.cpp index 7864e0e8..c822e4b4 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.cpp +++ b/dGame/dComponents/RocketLaunchLupComponent.cpp @@ -30,8 +30,8 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) { auto* characterComponent = originator->GetComponent(); if (!inventoryComponent || !characterComponent) return; - Item* rocket = nullptr; - rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID()); + + Item* rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID()); if (!rocket) return; rocket->Equip(true); diff --git a/dGame/dComponents/RocketLaunchLupComponent.h b/dGame/dComponents/RocketLaunchLupComponent.h index 8b21735a..37a4fb24 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.h +++ b/dGame/dComponents/RocketLaunchLupComponent.h @@ -15,9 +15,22 @@ public: RocketLaunchLupComponent(Entity* parent); ~RocketLaunchLupComponent() override; + /** + * Handles an OnUse event from some entity, preparing it for launch to some other world + * Builds m_LUPWorlds + * @param originator the entity that triggered the event + */ void OnUse(Entity* originator) override; + /** + * Handles an OnUse event from some entity, preparing it for launch to some other world + * + * @param originator the entity that triggered the event + * @param index index of the world that was selected + * @param sysAddr the address to send gamemessage responses to + */ void OnSelectWorld(Entity* originator, uint32_t index, const SystemAddress& sysAddr); private: + // vector of the LUP World Zone IDs, built from CDServer's LUPZoneIDs table std::vector m_LUPWorlds {}; }; diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 7cb8ae8f..f35a0d5b 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -2733,7 +2733,7 @@ void GameMessages::HandleEnterProperty(RakNet::BitStream* inStream, Entity* enti } auto rocketLaunchLupComponent = entity->GetComponent(); - if (rocketLaunchLupComponent) { + if (rocketLaunchLupComponent != nullptr) { rocketLaunchLupComponent->OnSelectWorld(player, index, sysAddr); } }