Move to shared pointer

This commit is contained in:
David Markowitz
2023-06-07 00:23:50 -07:00
parent ea9d0d8592
commit 9e9e4dc087
219 changed files with 743 additions and 748 deletions

View File

@@ -92,7 +92,7 @@ Item::Item(
inventory->AddManagedItem(this);
auto* entity = inventory->GetComponent()->GetOwningEntity();
auto entity = inventory->GetComponent()->GetOwningEntity();
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey, lootSourceType);
if (isModMoveAndEquip) {
@@ -166,7 +166,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
}
if (!silent) {
auto* entity = inventory->GetComponent()->GetOwningEntity();
auto entity = inventory->GetComponent()->GetOwningEntity();
if (value > count) {
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
@@ -231,7 +231,7 @@ void Item::UnEquip() {
}
bool Item::IsEquipped() const {
auto* component = inventory->GetComponent();
auto component = inventory->GetComponent();
for (const auto& pair : component->GetEquippedItems()) {
const auto item = pair.second;
@@ -278,7 +278,7 @@ void Item::UseNonEquip(Item* item) {
return;
}
auto* playerInventoryComponent = GetInventory()->GetComponent();
auto playerInventoryComponent = GetInventory()->GetComponent();
if (!playerInventoryComponent) {
Game::logger->LogDebug("Item", "no inventory component attached to item id %llu lot %i", this->GetId(), this->GetLot());
return;

View File

@@ -125,8 +125,8 @@ void ItemSet::OnEquip(const LOT lot) {
return;
}
auto* skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
auto* missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<MissionComponent>();
auto skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
auto missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<MissionComponent>();
for (const auto skill : skillSet) {
auto* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();

View File

@@ -37,8 +37,8 @@ void ItemSetPassiveAbility::Activate(Entity* target) {
return;
}
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
auto skillComponent = m_Parent->GetComponent<SkillComponent>();
if (destroyableComponent == nullptr || skillComponent == nullptr) {
return;
@@ -196,8 +196,8 @@ std::vector<ItemSetPassiveAbility> ItemSetPassiveAbility::FindAbilities(uint32_t
}
void ItemSetPassiveAbility::OnEnemySmshed(Entity* target) {
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
auto skillComponent = m_Parent->GetComponent<SkillComponent>();
if (destroyableComponent == nullptr || skillComponent == nullptr) {
return;