diff --git a/dGame/dComponents/PropertyVendorComponent.cpp b/dGame/dComponents/PropertyVendorComponent.cpp index 73f2dfaf..16e7c6ee 100644 --- a/dGame/dComponents/PropertyVendorComponent.cpp +++ b/dGame/dComponents/PropertyVendorComponent.cpp @@ -10,34 +10,30 @@ #include "PropertyManagementComponent.h" #include "UserManager.h" -PropertyVendorComponent::PropertyVendorComponent(Entity* parent) : Component(parent) { -} +PropertyVendorComponent::PropertyVendorComponent(Entity* parent) : Component(parent) { } void PropertyVendorComponent::OnUse(Entity* originator) { - if (PropertyManagementComponent::Instance() == nullptr) return; + if (!PropertyManagementComponent::Instance()) return; OnQueryPropertyData(originator, originator->GetSystemAddress()); - if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY) { - Game::logger->Log("PropertyVendorComponent", "Property vendor opening!"); + if (PropertyManagementComponent::Instance()->GetOwnerId() != LWOOBJID_EMPTY) return; + Game::logger->Log("PropertyVendorComponent", "Property vendor opening!"); - GameMessages::SendOpenPropertyVendor(m_ParentEntity->GetObjectID(), originator->GetSystemAddress()); - - return; - } + GameMessages::SendOpenPropertyVendor(m_ParentEntity->GetObjectID(), originator->GetSystemAddress()); } void PropertyVendorComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr) { - if (PropertyManagementComponent::Instance() == nullptr) return; + if (!PropertyManagementComponent::Instance()) return; PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, sysAddr, m_ParentEntity->GetObjectID()); } void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool confirmed, const LOT lot, const uint32_t count) { - if (PropertyManagementComponent::Instance() == nullptr) return; + if (!PropertyManagementComponent::Instance()) return; - if (PropertyManagementComponent::Instance()->Claim(originator->GetObjectID()) == false) { - Game::logger->Log("PropertyVendorComponent", "FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu", originator->GetObjectID()); + if (!PropertyManagementComponent::Instance()->Claim(originator->GetObjectID())) { + Game::logger->Log("PropertyVendorComponent", "Player %llu attempted to claim a property that did not belong to them.", originator->GetObjectID()); return; } @@ -51,6 +47,6 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress()); - Game::logger->Log("PropertyVendorComponent", "Fired event; (%d) (%i) (%i)", confirmed, lot, count); + Game::logger->Log("PropertyVendorComponent", "Fired event, (%d) (%i) (%i)", confirmed, lot, count); } diff --git a/dGame/dComponents/PropertyVendorComponent.h b/dGame/dComponents/PropertyVendorComponent.h index 0e6c6521..04544027 100644 --- a/dGame/dComponents/PropertyVendorComponent.h +++ b/dGame/dComponents/PropertyVendorComponent.h @@ -7,7 +7,7 @@ /** * The property guard that stands on a property before it's claimed, allows entities to attempt claiming this property. */ -class PropertyVendorComponent : public Component +class PropertyVendorComponent final : public Component { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;