Rename from GetOwningEntity to GetParentEntity

This commit is contained in:
David Markowitz
2023-06-09 01:28:01 -07:00
parent e2dfa1809d
commit f555ba8c25
14 changed files with 53 additions and 53 deletions

View File

@@ -149,7 +149,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
if (parameter.name == "max_health") {
const auto maxHealth = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
@@ -157,7 +157,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
} else if (parameter.name == "max_armor") {
const auto maxArmor = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
@@ -165,13 +165,13 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
} else if (parameter.name == "max_imagination") {
const auto maxImagination = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination);
} else if (parameter.name == "speed") {
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
auto* controllablePhysicsComponent = this->GetParentEntity()->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return;
const auto speed = parameter.value;
controllablePhysicsComponent->AddSpeedboost(speed);
@@ -185,7 +185,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
if (parameter.name == "max_health") {
const auto maxHealth = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
@@ -193,7 +193,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
} else if (parameter.name == "max_armor") {
const auto maxArmor = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
@@ -201,13 +201,13 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
} else if (parameter.name == "max_imagination") {
const auto maxImagination = parameter.value;
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
auto* destroyable = this->GetParentEntity()->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) return;
destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination);
} else if (parameter.name == "speed") {
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
auto* controllablePhysicsComponent = this->GetParentEntity()->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return;
const auto speed = parameter.value;
controllablePhysicsComponent->RemoveSpeedboost(speed);
@@ -233,7 +233,7 @@ void BuffComponent::ReApplyBuffs() {
}
}
Entity* BuffComponent::GetOwningEntity() const {
Entity* BuffComponent::GetParentEntity() const {
return m_OwningEntity;
}

View File

@@ -48,7 +48,7 @@ public:
~BuffComponent();
Entity* GetOwningEntity() const;
Entity* GetParentEntity() const;
void LoadFromXml(tinyxml2::XMLDocument* doc) override;

View File

@@ -20,7 +20,7 @@ public:
* Gets the owner of this component
* @return the owner of this component
*/
Entity* GetOwningEntity() const { return m_OwningEntity; };
Entity* GetParentEntity() const { return m_OwningEntity; };
/**
* Event called when this component is being used, e.g. when some entity interacted with it

View File

@@ -872,7 +872,7 @@ void DestroyableComponent::SetStatusImmunity(
}
void DestroyableComponent::FixStats() {
auto* entity = GetOwningEntity();
auto* entity = GetParentEntity();
if (entity == nullptr) return;

View File

@@ -261,7 +261,7 @@ void InventoryComponent::AddItem(
}
if (slot == -1) {
auto* player = dynamic_cast<Player*>(GetOwningEntity());
auto* player = dynamic_cast<Player*>(GetParentEntity());
if (player == nullptr) {
return;
@@ -687,7 +687,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
itemElement->SetAttribute("sk", item->GetSubKey());
// Begin custom xml
itemElement->SetAttribute("parent", item->GetOwningEntity());
itemElement->SetAttribute("parent", item->GetParentEntity());
// End custom xml
for (auto* data : item->GetConfig()) {
@@ -913,7 +913,7 @@ void InventoryComponent::UnEquipItem(Item* item) {
// Trigger property event
if (PropertyManagementComponent::Instance() != nullptr && item->GetCount() > 0 && Inventory::FindInventoryTypeForLot(item->GetLot()) == MODELS) {
PropertyManagementComponent::Instance()->GetOwningEntity()->OnZonePropertyModelRemovedWhileEquipped(m_OwningEntity);
PropertyManagementComponent::Instance()->GetParentEntity()->OnZonePropertyModelRemovedWhileEquipped(m_OwningEntity);
dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyModelRemovedWhileEquipped(m_OwningEntity);
}
}
@@ -1356,7 +1356,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
}
// If item is not a proxy, add its buff to the added buffs.
if (item->GetOwningEntity() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
if (item->GetParentEntity() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
}
}
@@ -1442,7 +1442,7 @@ std::vector<Item*> InventoryComponent::FindProxies(const LWOOBJID parent) {
for (const auto& pair : inventory->GetItems()) {
auto* item = pair.second;
if (item->GetOwningEntity() == parent) {
if (item->GetParentEntity() == parent) {
proxies.push_back(item);
}
}
@@ -1479,7 +1479,7 @@ bool InventoryComponent::IsParentValid(Item* root) {
for (const auto& candidate : items) {
auto* item = candidate.second;
if (item->GetOwningEntity() == id) {
if (item->GetParentEntity() == id) {
return true;
}
}
@@ -1497,7 +1497,7 @@ void InventoryComponent::CheckProxyIntegrity() {
for (const auto& candidate : items) {
auto* item = candidate.second;
const auto parent = item->GetOwningEntity();
const auto parent = item->GetParentEntity();
if (parent == LWOOBJID_EMPTY) {
continue;
@@ -1526,7 +1526,7 @@ void InventoryComponent::CheckProxyIntegrity() {
{
auto* item = candidate.second;
const auto parent = item->GetOwningEntity();
const auto parent = item->GetParentEntity();
if (parent != LWOOBJID_EMPTY)
{
@@ -1555,7 +1555,7 @@ void InventoryComponent::CheckProxyIntegrity() {
}
void InventoryComponent::PurgeProxies(Item* item) {
const auto root = item->GetOwningEntity();
const auto root = item->GetParentEntity();
if (root != LWOOBJID_EMPTY) {
item = FindItemById(root);

View File

@@ -846,7 +846,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
inventoryComponent->DespawnPet();
m_Owner = inventoryComponent->GetOwningEntity()->GetObjectID();
m_Owner = inventoryComponent->GetParentEntity()->GetObjectID();
auto* owner = GetOwner();
@@ -910,7 +910,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
auto playerInventoryComponent = playerInventory->GetComponent();
if (!playerInventoryComponent) return;
auto playerEntity = playerInventoryComponent->GetOwningEntity();
auto playerEntity = playerInventoryComponent->GetParentEntity();
if (!playerEntity) return;
auto* playerDestroyableComponent = playerEntity->GetComponent<DestroyableComponent>();
@@ -929,7 +929,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
// If we are out of imagination despawn the pet.
if (playerDestroyableComponent->GetImagination() == 0) {
this->Deactivate();
auto playerEntity = playerDestroyableComponent->GetOwningEntity();
auto playerEntity = playerDestroyableComponent->GetParentEntity();
if (!playerEntity) return;
GameMessages::SendUseItemRequirementsResponse(playerEntity->GetObjectID(), playerEntity->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);