diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 3377e8cd..4d4a5af9 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -136,7 +136,7 @@ void Entity::Initialize() { for (const auto& [componentTemplate, componentId] : components) { switch (componentTemplate) { case eReplicaComponentType::CONTROLLABLE_PHYSICS: - AddComponent(this); + AddComponent(); break; case eReplicaComponentType::RENDER: break; @@ -432,12 +432,12 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa } void Entity::SetProximityRadius(float proxRadius, std::string name) { - auto proximityMonitorComponent = AddComponent(this); + auto proximityMonitorComponent = AddComponent(); if (proximityMonitorComponent) proximityMonitorComponent->SetProximityRadius(proxRadius, name); } void Entity::SetProximityRadius(dpEntity* entity, std::string name) { - auto proximityMonitorComponent = AddComponent(this); + auto proximityMonitorComponent = AddComponent(); if (proximityMonitorComponent) proximityMonitorComponent->SetProximityRadius(entity, name); } diff --git a/dGame/Entity.h b/dGame/Entity.h index 9f3198a6..8137e2b2 100644 --- a/dGame/Entity.h +++ b/dGame/Entity.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef __ENTITY__H__ +#define __ENTITY__H__ #include #include @@ -146,8 +147,8 @@ public: bool HasComponent(eReplicaComponentType componentId) const; - template - std::shared_ptr AddComponent(ConstructorValues... arguments); + template + std::shared_ptr AddComponent(ConstructorValues... arguments); std::vector> GetScriptComponents(); @@ -290,6 +291,8 @@ public: Entity* GetScheduledKiller() { return m_ScheduleKiller; } + std::unordered_map& GetComponents() { return m_Components; } + protected: LWOOBJID m_ObjectID; @@ -481,9 +484,14 @@ T Entity::GetNetworkVar(const std::u16string& name) { return LDFData::Default; } -template -std::shared_ptr Entity::AddComponent(ConstructorValues...arguments) { - if (GetComponent()) return nullptr; +template +std::shared_ptr Entity::AddComponent(ConstructorValues...arguments) { + auto component = GetComponent(); + if (component) return component; - m_Components.insert_or_assign(ComponentType::ComponentType, std::make_shared(arguments...)); + auto insertedComponent = m_Components.insert_or_assign(Cmpt::ComponentType, + std::make_shared(this, std::forward(arguments)...)).first->second; + return std::dynamic_pointer_cast(insertedComponent); } + +#endif //!__ENTITY__H__ diff --git a/dGame/EntityInitializeOld.cc b/dGame/EntityInitializeOld.cc index 321b220c..edb5ba2e 100644 --- a/dGame/EntityInitializeOld.cc +++ b/dGame/EntityInitializeOld.cc @@ -630,8 +630,8 @@ no_ghosting: TriggerEvent(eTriggerEventType::CREATE, this); if (m_Character) { - auto* controllablePhysicsComponent = GetComponent(); - auto* levelComponent = GetComponent(); + auto controllablePhysicsComponent = GetComponent(); + auto levelComponent = GetComponent(); if (controllablePhysicsComponent && levelComponent) { controllablePhysicsComponent->SetSpeedMultiplier(levelComponent->GetSpeedBase() / 500.0f); diff --git a/dGame/dBehaviors/DamageAbsorptionBehavior.cpp b/dGame/dBehaviors/DamageAbsorptionBehavior.cpp index 799641c4..84f597f1 100644 --- a/dGame/dBehaviors/DamageAbsorptionBehavior.cpp +++ b/dGame/dBehaviors/DamageAbsorptionBehavior.cpp @@ -42,7 +42,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon return; } - auto* destroyable = target->GetComponent(); + auto destroyable = target->GetComponent(); if (destroyable == nullptr) { return; diff --git a/dGame/dBehaviors/DamageReductionBehavior.cpp b/dGame/dBehaviors/DamageReductionBehavior.cpp index 2b18b7c2..e28839d5 100644 --- a/dGame/dBehaviors/DamageReductionBehavior.cpp +++ b/dGame/dBehaviors/DamageReductionBehavior.cpp @@ -16,7 +16,7 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream return; } - auto* destroyable = target->GetComponent(); + auto destroyable = target->GetComponent(); if (destroyable == nullptr) { return; @@ -40,7 +40,7 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont return; } - auto* destroyable = target->GetComponent(); + auto destroyable = target->GetComponent(); if (destroyable == nullptr) { return; diff --git a/dGame/dBehaviors/DarkInspirationBehavior.cpp b/dGame/dBehaviors/DarkInspirationBehavior.cpp index ea80cbba..45d501b1 100644 --- a/dGame/dBehaviors/DarkInspirationBehavior.cpp +++ b/dGame/dBehaviors/DarkInspirationBehavior.cpp @@ -14,7 +14,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream return; } - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent == nullptr) { return; @@ -34,7 +34,7 @@ void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStr return; } - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent == nullptr) { return; diff --git a/dGame/dBehaviors/FallSpeedBehavior.cpp b/dGame/dBehaviors/FallSpeedBehavior.cpp index 158c87f6..5b8a50cd 100644 --- a/dGame/dBehaviors/FallSpeedBehavior.cpp +++ b/dGame/dBehaviors/FallSpeedBehavior.cpp @@ -11,7 +11,7 @@ void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS auto* target = EntityManager::Instance()->GetEntity(branch.target); if (!target) return; - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (!controllablePhysicsComponent) return; controllablePhysicsComponent->SetGravityScale(m_PercentSlowed); EntityManager::Instance()->SerializeEntity(target); @@ -39,7 +39,7 @@ void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext bran auto* target = EntityManager::Instance()->GetEntity(branch.target); if (!target) return; - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (!controllablePhysicsComponent) return; controllablePhysicsComponent->SetGravityScale(1); EntityManager::Instance()->SerializeEntity(target); diff --git a/dGame/dBehaviors/ForceMovementBehavior.cpp b/dGame/dBehaviors/ForceMovementBehavior.cpp index 52359cf7..5c0cafba 100644 --- a/dGame/dBehaviors/ForceMovementBehavior.cpp +++ b/dGame/dBehaviors/ForceMovementBehavior.cpp @@ -44,7 +44,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster); if (casterEntity != nullptr) { - auto* controllablePhysicsComponent = casterEntity->GetComponent(); + auto controllablePhysicsComponent = casterEntity->GetComponent(); if (controllablePhysicsComponent != nullptr) { if (m_Forward == 1) { @@ -74,7 +74,7 @@ void ForceMovementBehavior::Load() { void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster); if (casterEntity != nullptr) { - auto* controllablePhysicsComponent = casterEntity->GetComponent(); + auto controllablePhysicsComponent = casterEntity->GetComponent(); if (controllablePhysicsComponent != nullptr) { controllablePhysicsComponent->SetPosition(controllablePhysicsComponent->GetPosition() + controllablePhysicsComponent->GetVelocity() * m_Duration); diff --git a/dGame/dBehaviors/HealBehavior.cpp b/dGame/dBehaviors/HealBehavior.cpp index 66fe2c79..4c4c2bf7 100644 --- a/dGame/dBehaviors/HealBehavior.cpp +++ b/dGame/dBehaviors/HealBehavior.cpp @@ -16,7 +16,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea return; } - auto* destroyable = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto destroyable = entity->GetComponent(); if (destroyable == nullptr) { Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target); diff --git a/dGame/dBehaviors/ImaginationBehavior.cpp b/dGame/dBehaviors/ImaginationBehavior.cpp index 59b192b0..f46d7ad6 100644 --- a/dGame/dBehaviors/ImaginationBehavior.cpp +++ b/dGame/dBehaviors/ImaginationBehavior.cpp @@ -13,7 +13,7 @@ void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi return; } - auto* destroyable = entity->GetComponent(); + auto destroyable = entity->GetComponent(); if (destroyable == nullptr) { return; diff --git a/dGame/dBehaviors/ImmunityBehavior.cpp b/dGame/dBehaviors/ImmunityBehavior.cpp index a5dd4c85..9082bb80 100644 --- a/dGame/dBehaviors/ImmunityBehavior.cpp +++ b/dGame/dBehaviors/ImmunityBehavior.cpp @@ -17,7 +17,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt return; } - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent) { destroyableComponent->SetStatusImmunity( eStateChangeType::PUSH, @@ -33,7 +33,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt ); } - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (controllablePhysicsComponent) { controllablePhysicsComponent->SetStunImmunity( eStateChangeType::PUSH, @@ -63,7 +63,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra return; } - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent) { destroyableComponent->SetStatusImmunity( eStateChangeType::POP, @@ -79,7 +79,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra ); } - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (controllablePhysicsComponent) { controllablePhysicsComponent->SetStunImmunity( eStateChangeType::POP, diff --git a/dGame/dBehaviors/InterruptBehavior.cpp b/dGame/dBehaviors/InterruptBehavior.cpp index 9035c092..ab711b10 100644 --- a/dGame/dBehaviors/InterruptBehavior.cpp +++ b/dGame/dBehaviors/InterruptBehavior.cpp @@ -46,7 +46,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS if (target == nullptr) return; - auto* skillComponent = target->GetComponent(); + auto skillComponent = target->GetComponent(); if (skillComponent == nullptr) return; @@ -71,7 +71,7 @@ void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b if (target == nullptr) return; - auto* skillComponent = target->GetComponent(); + auto skillComponent = target->GetComponent(); if (skillComponent == nullptr) return; diff --git a/dGame/dBehaviors/KnockbackBehavior.cpp b/dGame/dBehaviors/KnockbackBehavior.cpp index 1b878ed0..5c820e59 100644 --- a/dGame/dBehaviors/KnockbackBehavior.cpp +++ b/dGame/dBehaviors/KnockbackBehavior.cpp @@ -24,7 +24,7 @@ void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b auto* target = EntityManager::Instance()->GetEntity(branch.target); if (target != nullptr) { - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent != nullptr) { blocked = destroyableComponent->IsKnockbackImmune(); diff --git a/dGame/dBehaviors/OverTimeBehavior.cpp b/dGame/dBehaviors/OverTimeBehavior.cpp index 5afbbd26..df597c00 100644 --- a/dGame/dBehaviors/OverTimeBehavior.cpp +++ b/dGame/dBehaviors/OverTimeBehavior.cpp @@ -24,7 +24,7 @@ void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt if (entity == nullptr) return; - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent == nullptr) return; diff --git a/dGame/dBehaviors/ProjectileAttackBehavior.cpp b/dGame/dBehaviors/ProjectileAttackBehavior.cpp index f65421cb..6fc724e1 100644 --- a/dGame/dBehaviors/ProjectileAttackBehavior.cpp +++ b/dGame/dBehaviors/ProjectileAttackBehavior.cpp @@ -24,7 +24,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea return; } - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent == nullptr) { Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", -context->originator); @@ -69,7 +69,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt return; } - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent == nullptr) { Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", context->originator); diff --git a/dGame/dBehaviors/PullToPointBehavior.cpp b/dGame/dBehaviors/PullToPointBehavior.cpp index 7427ccc4..e553d3a9 100644 --- a/dGame/dBehaviors/PullToPointBehavior.cpp +++ b/dGame/dBehaviors/PullToPointBehavior.cpp @@ -14,7 +14,7 @@ void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi return; } - auto* movement = target->GetComponent(); + auto movement = target->GetComponent(); if (movement == nullptr) { return; diff --git a/dGame/dBehaviors/RemoveBuffBehavior.cpp b/dGame/dBehaviors/RemoveBuffBehavior.cpp index be3066ac..fb9f49ec 100644 --- a/dGame/dBehaviors/RemoveBuffBehavior.cpp +++ b/dGame/dBehaviors/RemoveBuffBehavior.cpp @@ -9,7 +9,7 @@ void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit auto* entity = EntityManager::Instance()->GetEntity(context->caster); if (!entity) return; - auto* buffComponent = entity->GetComponent(); + auto buffComponent = entity->GetComponent(); if (!buffComponent) return; buffComponent->RemoveBuff(m_BuffId, false, m_RemoveImmunity); diff --git a/dGame/dBehaviors/RepairBehavior.cpp b/dGame/dBehaviors/RepairBehavior.cpp index ce2e5fd2..836923a4 100644 --- a/dGame/dBehaviors/RepairBehavior.cpp +++ b/dGame/dBehaviors/RepairBehavior.cpp @@ -16,7 +16,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str return; } - auto* destroyable = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto destroyable = entity->GetComponent(); if (destroyable == nullptr) { Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target); diff --git a/dGame/dBehaviors/SpawnBehavior.cpp b/dGame/dBehaviors/SpawnBehavior.cpp index 75c84f6c..a79ad4c0 100644 --- a/dGame/dBehaviors/SpawnBehavior.cpp +++ b/dGame/dBehaviors/SpawnBehavior.cpp @@ -53,7 +53,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea entity->SetOwnerOverride(context->originator); // Unset the flag to reposition the player, this makes it harder to glitch out of the map - auto* rebuildComponent = entity->GetComponent(); + auto rebuildComponent = entity->GetComponent(); if (rebuildComponent != nullptr) { rebuildComponent->SetRepositionPlayer(false); @@ -87,9 +87,9 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext return; } - auto* destroyable = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto destroyable = entity->GetComponent(); - if (destroyable == nullptr) { + if (!destroyable) { entity->Smash(context->originator); return; diff --git a/dGame/dBehaviors/SpeedBehavior.cpp b/dGame/dBehaviors/SpeedBehavior.cpp index d326aa45..b780d215 100644 --- a/dGame/dBehaviors/SpeedBehavior.cpp +++ b/dGame/dBehaviors/SpeedBehavior.cpp @@ -12,7 +12,7 @@ void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea auto* target = EntityManager::Instance()->GetEntity(branch.target); if (!target) return; - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (!controllablePhysicsComponent) return; controllablePhysicsComponent->AddSpeedboost(m_RunSpeed); @@ -41,7 +41,7 @@ void SpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, auto* target = EntityManager::Instance()->GetEntity(branch.target); if (!target) return; - auto* controllablePhysicsComponent = target->GetComponent(); + auto controllablePhysicsComponent = target->GetComponent(); if (!controllablePhysicsComponent) return; controllablePhysicsComponent->RemoveSpeedboost(m_RunSpeed); diff --git a/dGame/dBehaviors/StunBehavior.cpp b/dGame/dBehaviors/StunBehavior.cpp index 4e34d3a2..9b91d61e 100644 --- a/dGame/dBehaviors/StunBehavior.cpp +++ b/dGame/dBehaviors/StunBehavior.cpp @@ -33,7 +33,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream * If our target is an enemy we can go ahead and stun it. */ - auto* combatAiComponent = static_cast(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI)); + auto combatAiComponent = target->GetComponent(); if (combatAiComponent == nullptr) { return; @@ -56,7 +56,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr * See if we can stun ourselves */ - auto* combatAiComponent = static_cast(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI)); + auto combatAiComponent = self->GetComponent(); if (combatAiComponent == nullptr) { return; @@ -72,7 +72,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr auto* target = EntityManager::Instance()->GetEntity(branch.target); if (target != nullptr) { - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent != nullptr) { blocked = destroyableComponent->IsKnockbackImmune(); @@ -91,7 +91,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr * If our target is an enemy we can go ahead and stun it. */ - auto* combatAiComponent = static_cast(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI)); + auto combatAiComponent = target->GetComponent(); if (combatAiComponent == nullptr) { return; diff --git a/dGame/dBehaviors/SwitchBehavior.cpp b/dGame/dBehaviors/SwitchBehavior.cpp index bd261906..5395e32f 100644 --- a/dGame/dBehaviors/SwitchBehavior.cpp +++ b/dGame/dBehaviors/SwitchBehavior.cpp @@ -22,7 +22,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre return; } - auto* destroyableComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); if (destroyableComponent == nullptr) { return; @@ -46,7 +46,7 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS state = entity != nullptr; if (state && m_targetHasBuff != 0) { - auto* buffComponent = entity->GetComponent(); + auto buffComponent = entity->GetComponent(); if (buffComponent != nullptr && !buffComponent->HasBuff(m_targetHasBuff)) { state = false; diff --git a/dGame/dBehaviors/TacArcBehavior.cpp b/dGame/dBehaviors/TacArcBehavior.cpp index 91df3879..4583bd29 100644 --- a/dGame/dBehaviors/TacArcBehavior.cpp +++ b/dGame/dBehaviors/TacArcBehavior.cpp @@ -82,7 +82,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS return; } - const auto* destroyableComponent = self->GetComponent(); + const auto destroyableComponent = self->GetComponent(); if ((this->m_usePickedTarget || context->clientInitalized) && branch.target > 0) { const auto* target = EntityManager::Instance()->GetEntity(branch.target); @@ -101,7 +101,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS return; } - auto* combatAi = self->GetComponent(); + auto combatAi = self->GetComponent(); const auto casterPosition = self->GetPosition(); diff --git a/dGame/dBehaviors/TauntBehavior.cpp b/dGame/dBehaviors/TauntBehavior.cpp index 7ed3b897..878da4fd 100644 --- a/dGame/dBehaviors/TauntBehavior.cpp +++ b/dGame/dBehaviors/TauntBehavior.cpp @@ -15,7 +15,7 @@ void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea return; } - auto* combatComponent = target->GetComponent(); + auto combatComponent = target->GetComponent(); if (combatComponent != nullptr) { combatComponent->Taunt(context->originator, m_threatToAdd); @@ -31,7 +31,7 @@ void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt return; } - auto* combatComponent = target->GetComponent(); + auto combatComponent = target->GetComponent(); if (combatComponent != nullptr) { combatComponent->Taunt(context->originator, m_threatToAdd); diff --git a/dGame/dComponents/BaseCombatAIComponent.cpp b/dGame/dComponents/BaseCombatAIComponent.cpp index 4e6dc092..f95cab1c 100644 --- a/dGame/dComponents/BaseCombatAIComponent.cpp +++ b/dGame/dComponents/BaseCombatAIComponent.cpp @@ -189,10 +189,11 @@ void BaseCombatAIComponent::Update(const float deltaTime) { m_StartPosition = m_OwningEntity->GetPosition(); } - m_MovementAI = m_OwningEntity->GetComponent(); - if (m_MovementAI == nullptr) { - return; + m_MovementAI = m_OwningEntity->GetComponent(); + if (m_MovementAI == nullptr) { + return; + } } if (stunnedThisFrame) { @@ -243,7 +244,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) { bool hadRemainingDowntime = m_SkillTime > 0.0f; if (m_SkillTime > 0.0f) m_SkillTime -= deltaTime; - auto* rebuild = m_OwningEntity->GetComponent(); + auto rebuild = m_OwningEntity->GetComponent(); if (rebuild != nullptr) { const auto state = rebuild->GetState(); @@ -253,7 +254,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) { } } - auto* skillComponent = m_OwningEntity->GetComponent(); + auto skillComponent = m_OwningEntity->GetComponent(); if (skillComponent == nullptr) { return; @@ -287,7 +288,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) { } if (!m_TetherEffectActive && m_OutOfCombat && (m_OutOfCombatTime -= deltaTime) <= 0) { - auto* destroyableComponent = m_OwningEntity->GetComponent(); + auto destroyableComponent = m_OwningEntity->GetComponent(); if (destroyableComponent != nullptr && destroyableComponent->HasFaction(4)) { auto serilizationRequired = false; @@ -547,13 +548,13 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const { return false; } - auto* destroyable = entity->GetComponent(); + auto destroyable = entity->GetComponent(); if (destroyable == nullptr) { return false; } - auto* referenceDestroyable = m_OwningEntity->GetComponent(); + auto referenceDestroyable = m_OwningEntity->GetComponent(); if (referenceDestroyable == nullptr) { Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_OwningEntity->GetObjectID()); @@ -561,7 +562,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const { return false; } - auto* quickbuild = entity->GetComponent(); + auto quickbuild = entity->GetComponent(); if (quickbuild != nullptr) { const auto state = quickbuild->GetState(); diff --git a/dGame/dComponents/BaseCombatAIComponent.h b/dGame/dComponents/BaseCombatAIComponent.h index 8bf6140a..37589d34 100644 --- a/dGame/dComponents/BaseCombatAIComponent.h +++ b/dGame/dComponents/BaseCombatAIComponent.h @@ -10,6 +10,7 @@ #include "Component.h" #include "eReplicaComponentType.h" +#include #include #include @@ -319,7 +320,7 @@ private: /** * The component that handles movement AI, also owned by this entity */ - MovementAIComponent* m_MovementAI; + std::shared_ptr m_MovementAI; /** * The position at which this entity spawned diff --git a/dGame/dComponents/BouncerComponent.cpp b/dGame/dComponents/BouncerComponent.cpp index e26e23a8..0013021f 100644 --- a/dGame/dComponents/BouncerComponent.cpp +++ b/dGame/dComponents/BouncerComponent.cpp @@ -71,7 +71,7 @@ void BouncerComponent::LookupPetSwitch() { const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group); for (auto* entity : entities) { - auto* switchComponent = entity->GetComponent(); + auto switchComponent = entity->GetComponent(); if (switchComponent != nullptr) { switchComponent->SetPetBouncer(this); diff --git a/dGame/dComponents/BuffComponent.cpp b/dGame/dComponents/BuffComponent.cpp index 3a10c3c3..5d4b3f91 100644 --- a/dGame/dComponents/BuffComponent.cpp +++ b/dGame/dComponents/BuffComponent.cpp @@ -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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); 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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); 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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); if (destroyable == nullptr) return; destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination); } else if (parameter.name == "speed") { - auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent(); + auto controllablePhysicsComponent = this->GetOwningEntity()->GetComponent(); 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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); 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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); 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(); + auto destroyable = this->GetOwningEntity()->GetComponent(); if (destroyable == nullptr) return; destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination); } else if (parameter.name == "speed") { - auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent(); + auto controllablePhysicsComponent = this->GetOwningEntity()->GetComponent(); if (!controllablePhysicsComponent) return; const auto speed = parameter.value; controllablePhysicsComponent->RemoveSpeedboost(speed); diff --git a/dGame/dComponents/BuildBorderComponent.cpp b/dGame/dComponents/BuildBorderComponent.cpp index 5b46d573..c33ae8d5 100644 --- a/dGame/dComponents/BuildBorderComponent.cpp +++ b/dGame/dComponents/BuildBorderComponent.cpp @@ -27,7 +27,7 @@ void BuildBorderComponent::OnUse(Entity* originator) { Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque"); } - auto* inventoryComponent = originator->GetComponent(); + auto inventoryComponent = originator->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -63,7 +63,7 @@ void BuildBorderComponent::OnUse(Entity* originator) { GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition()); } - InventoryComponent* inv = m_OwningEntity->GetComponent(); + auto inv = m_OwningEntity->GetComponent(); if (!inv) return; inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here } diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index 7bd4cc19..7d757c62 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -367,7 +367,7 @@ void CharacterComponent::SetLastRocketConfig(std::u16string config) { Item* CharacterComponent::GetRocket(Entity* player) { Item* rocket = nullptr; - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (!inventoryComponent) return rocket; diff --git a/dGame/dComponents/Component.cpp b/dGame/dComponents/Component.cpp index d46c57dc..1f267880 100644 --- a/dGame/dComponents/Component.cpp +++ b/dGame/dComponents/Component.cpp @@ -38,6 +38,6 @@ void Component::LoadTemplateData() { } -void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction = false) { +void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction) { } diff --git a/dGame/dComponents/ControllablePhysicsComponent.cpp b/dGame/dComponents/ControllablePhysicsComponent.cpp index 04f627e7..2e8d0e40 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.cpp +++ b/dGame/dComponents/ControllablePhysicsComponent.cpp @@ -321,7 +321,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) { // Recalculate speedboost since we removed one m_SpeedBoost = 0.0f; if (m_ActiveSpeedBoosts.empty()) { // no active speed boosts left, so return to base speed - auto* levelProgressionComponent = m_OwningEntity->GetComponent(); + auto levelProgressionComponent = m_OwningEntity->GetComponent(); if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase(); } else { // Used the last applied speedboost m_SpeedBoost = m_ActiveSpeedBoosts.back(); diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index bb47ce32..3de0ff4b 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -185,7 +185,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) { return; } - auto* buffComponent = m_OwningEntity->GetComponent(); + auto buffComponent = m_OwningEntity->GetComponent(); if (buffComponent != nullptr) { buffComponent->LoadFromXml(doc); @@ -207,7 +207,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) { return; } - auto* buffComponent = m_OwningEntity->GetComponent(); + auto buffComponent = m_OwningEntity->GetComponent(); if (buffComponent != nullptr) { buffComponent->UpdateXml(doc); @@ -224,7 +224,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) { void DestroyableComponent::SetHealth(int32_t value) { m_DirtyHealth = true; - auto* characterComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); if (characterComponent != nullptr) { characterComponent->TrackHealthDelta(value - m_iHealth); } @@ -262,14 +262,14 @@ void DestroyableComponent::SetArmor(int32_t value) { // If Destroyable Component already has zero armor do not trigger the passive ability again. bool hadArmor = m_iArmor > 0; - auto* characterComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); if (characterComponent != nullptr) { characterComponent->TrackArmorDelta(value - m_iArmor); } m_iArmor = value; - auto* inventroyComponent = m_OwningEntity->GetComponent(); + auto inventroyComponent = m_OwningEntity->GetComponent(); if (m_iArmor == 0 && inventroyComponent != nullptr && hadArmor) { inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::SentinelArmor); } @@ -300,14 +300,14 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) { void DestroyableComponent::SetImagination(int32_t value) { m_DirtyHealth = true; - auto* characterComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); if (characterComponent != nullptr) { characterComponent->TrackImaginationDelta(value - m_iImagination); } m_iImagination = value; - auto* inventroyComponent = m_OwningEntity->GetComponent(); + auto inventroyComponent = m_OwningEntity->GetComponent(); if (m_iImagination == 0 && inventroyComponent != nullptr) { inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::AssemblyImagination); } @@ -407,7 +407,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore } bool DestroyableComponent::IsEnemy(const Entity* other) const { - const auto* otherDestroyableComponent = other->GetComponent(); + const auto otherDestroyableComponent = other->GetComponent(); if (otherDestroyableComponent != nullptr) { for (const auto enemyFaction : m_EnemyFactionIDs) { for (const auto otherFaction : otherDestroyableComponent->GetFactionIDs()) { @@ -421,7 +421,7 @@ bool DestroyableComponent::IsEnemy(const Entity* other) const { } bool DestroyableComponent::IsFriend(const Entity* other) const { - const auto* otherDestroyableComponent = other->GetComponent(); + const auto otherDestroyableComponent = other->GetComponent(); if (otherDestroyableComponent != nullptr) { for (const auto enemyFaction : m_EnemyFactionIDs) { for (const auto otherFaction : otherDestroyableComponent->GetFactionIDs()) { @@ -455,8 +455,8 @@ bool DestroyableComponent::IsImmune() const { } bool DestroyableComponent::IsKnockbackImmune() const { - auto* characterComponent = m_OwningEntity->GetComponent(); - auto* inventoryComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); + auto inventoryComponent = m_OwningEntity->GetComponent(); if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING) { const auto hasPassive = inventoryComponent->HasAnyPassive({ @@ -493,13 +493,13 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor return false; } - auto* targetDestroyable = targetEntity->GetComponent(); + auto targetDestroyable = targetEntity->GetComponent(); if (targetDestroyable == nullptr) { return false; } - auto* targetQuickbuild = targetEntity->GetComponent(); + auto targetQuickbuild = targetEntity->GetComponent(); if (targetQuickbuild != nullptr) { const auto state = targetQuickbuild->GetState(); @@ -651,7 +651,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32 } if (health != 0) { - auto* combatComponent = m_OwningEntity->GetComponent(); + auto combatComponent = m_OwningEntity->GetComponent(); if (combatComponent != nullptr) { combatComponent->Taunt(source, sourceDamage * 10); // * 10 is arbatrary @@ -710,13 +710,13 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType const auto isEnemy = m_OwningEntity->GetComponent() != nullptr; - auto* inventoryComponent = owner->GetComponent(); + auto inventoryComponent = owner->GetComponent(); if (inventoryComponent != nullptr && isEnemy) { inventoryComponent->TriggerPassiveAbility(PassiveAbilityTrigger::EnemySmashed, m_OwningEntity); } - auto* missions = owner->GetComponent(); + auto missions = owner->GetComponent(); if (missions != nullptr) { if (team != nullptr) { @@ -725,7 +725,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType if (member == nullptr) continue; - auto* memberMissions = member->GetComponent(); + auto memberMissions = member->GetComponent(); if (memberMissions == nullptr) continue; @@ -750,7 +750,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType if (team != nullptr && m_OwningEntity->GetComponent() != nullptr) { LWOOBJID specificOwner = LWOOBJID_EMPTY; - auto* scriptedActivityComponent = m_OwningEntity->GetComponent(); + auto scriptedActivityComponent = m_OwningEntity->GetComponent(); uint32_t teamSize = team->members.size(); uint32_t lootMatrixId = GetLootMatrixID(); @@ -877,11 +877,11 @@ void DestroyableComponent::FixStats() { if (entity == nullptr) return; // Reset skill component and buff component - auto* skillComponent = entity->GetComponent(); - auto* buffComponent = entity->GetComponent(); - auto* missionComponent = entity->GetComponent(); - auto* inventoryComponent = entity->GetComponent(); - auto* destroyableComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); + auto buffComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); // If any of the components are nullptr, return if (skillComponent == nullptr || buffComponent == nullptr || missionComponent == nullptr || inventoryComponent == nullptr || destroyableComponent == nullptr) { @@ -976,7 +976,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){ //check if this is a player: if (m_OwningEntity->IsPlayer()) { //remove hardcore_lose_uscore_on_death_percent from the player's uscore: - auto* character = m_OwningEntity->GetComponent(); + auto character = m_OwningEntity->GetComponent(); auto uscore = character->GetUScore(); auto uscoreToLose = uscore * (EntityManager::Instance()->GetHardcoreLoseUscoreOnDeathPercent() / 100); @@ -986,7 +986,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){ if (EntityManager::Instance()->GetHardcoreDropinventoryOnDeath()) { //drop all items from inventory: - auto* inventory = m_OwningEntity->GetComponent(); + auto inventory = m_OwningEntity->GetComponent(); if (inventory) { //get the items inventory: auto items = inventory->GetInventory(eInventoryType::ITEMS); @@ -1029,7 +1029,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){ //award the player some u-score: auto* player = EntityManager::Instance()->GetEntity(source); if (player && player->IsPlayer()) { - auto* playerStats = player->GetComponent(); + auto playerStats = player->GetComponent(); if (playerStats) { //get the maximum health from this enemy: auto maxHealth = GetMaxHealth(); diff --git a/dGame/dComponents/DestroyableComponent.h b/dGame/dComponents/DestroyableComponent.h index 66c8374d..1b6a7907 100644 --- a/dGame/dComponents/DestroyableComponent.h +++ b/dGame/dComponents/DestroyableComponent.h @@ -19,7 +19,7 @@ enum class eStateChangeType : uint32_t; */ class DestroyableComponent : public Component { public: - static const eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE; + inline static const eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE; DestroyableComponent(Entity* parentEntity); ~DestroyableComponent() override; diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 28294dbf..1cbef0e0 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -189,7 +189,7 @@ void InventoryComponent::AddItem( inventoryType = Inventory::FindInventoryTypeForLot(lot); } - auto* missions = static_cast(this->m_OwningEntity->GetComponent(eReplicaComponentType::MISSION)); + auto missions = m_OwningEntity->GetComponent(); auto* inventory = GetInventory(inventoryType); @@ -378,7 +378,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in item->SetCount(item->GetCount() - delta, false, false); } - auto* missionComponent = m_OwningEntity->GetComponent(); + auto missionComponent = m_OwningEntity->GetComponent(); if (missionComponent != nullptr) { if (IsTransferInventory(inventory)) { @@ -833,7 +833,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) { for (auto* lauchPad : rocketLauchPads) { if (Vector3::DistanceSquared(lauchPad->GetPosition(), position) > 13 * 13) continue; - auto* characterComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); if (characterComponent != nullptr) characterComponent->SetLastRocketItemID(item->GetId()); @@ -950,10 +950,10 @@ void InventoryComponent::UnequipScripts(Item* unequippedItem) { } void InventoryComponent::HandlePossession(Item* item) { - auto* characterComponent = m_OwningEntity->GetComponent(); + auto characterComponent = m_OwningEntity->GetComponent(); if (!characterComponent) return; - auto* possessorComponent = m_OwningEntity->GetComponent(); + auto possessorComponent = m_OwningEntity->GetComponent(); if (!possessorComponent) return; // Don't do anything if we are busy dismounting @@ -986,7 +986,7 @@ void InventoryComponent::HandlePossession(Item* item) { auto* mount = EntityManager::Instance()->CreateEntity(info, nullptr, m_OwningEntity); // Check to see if the mount is a vehicle, if so, flip it - auto* vehicleComponent = mount->GetComponent(); + auto vehicleComponent = mount->GetComponent(); if (vehicleComponent) { auto angles = startRotation.GetEulerAngles(); // Make it right side up @@ -1000,14 +1000,14 @@ void InventoryComponent::HandlePossession(Item* item) { } // Setup the destroyable stats - auto* destroyableComponent = mount->GetComponent(); + auto destroyableComponent = mount->GetComponent(); if (destroyableComponent) { destroyableComponent->SetIsSmashable(false); destroyableComponent->SetIsImmune(true); } // Mount it - auto* possessableComponent = mount->GetComponent(); + auto possessableComponent = mount->GetComponent(); if (possessableComponent) { possessableComponent->SetIsItemSpawned(true); possessableComponent->SetPossessor(m_OwningEntity->GetObjectID()); @@ -1227,7 +1227,7 @@ bool InventoryComponent::HasAnyPassive(const std::vectorGetObjectID()); + auto current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID()); if (current != nullptr) { current->Deactivate(); @@ -1235,7 +1235,7 @@ void InventoryComponent::DespawnPet() { } void InventoryComponent::SpawnPet(Item* item) { - auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID()); + auto current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID()); if (current != nullptr) { current->Deactivate(); @@ -1261,7 +1261,7 @@ void InventoryComponent::SpawnPet(Item* item) { auto* pet = EntityManager::Instance()->CreateEntity(info); - auto* petComponent = pet->GetComponent(); + auto petComponent = pet->GetComponent(); if (petComponent != nullptr) { petComponent->Activate(item); @@ -1339,7 +1339,7 @@ std::vector InventoryComponent::FindBuffs(Item* item, bool castOnEquip return entry.objectTemplate == static_cast(item->GetLot()); }); - auto* missions = static_cast(m_OwningEntity->GetComponent(eReplicaComponentType::MISSION)); + auto missions = m_OwningEntity->GetComponent(); for (const auto& result : results) { if (result.castOnType == 1) { diff --git a/dGame/dComponents/LevelProgressionComponent.cpp b/dGame/dComponents/LevelProgressionComponent.cpp index 682b9ac3..dfcbebf6 100644 --- a/dGame/dComponents/LevelProgressionComponent.cpp +++ b/dGame/dComponents/LevelProgressionComponent.cpp @@ -49,8 +49,8 @@ void LevelProgressionComponent::HandleLevelUp() { const auto& rewards = rewardsTable->GetByLevelID(m_Level); bool rewardingItem = rewards.size() > 0; - auto* inventoryComponent = m_OwningEntity->GetComponent(); - auto* controllablePhysicsComponent = m_OwningEntity->GetComponent(); + auto inventoryComponent = m_OwningEntity->GetComponent(); + auto controllablePhysicsComponent = m_OwningEntity->GetComponent(); if (!inventoryComponent || !controllablePhysicsComponent) return; // Tell the client we beginning to send level rewards. @@ -84,6 +84,6 @@ void LevelProgressionComponent::HandleLevelUp() { void LevelProgressionComponent::SetRetroactiveBaseSpeed(){ if (m_Level >= 20) m_SpeedBase = 525.0f; - auto* controllablePhysicsComponent = m_OwningEntity->GetComponent(); + auto controllablePhysicsComponent = m_OwningEntity->GetComponent(); if (controllablePhysicsComponent) controllablePhysicsComponent->SetSpeedMultiplier(m_SpeedBase / 500.0f); } diff --git a/dGame/dComponents/MissionOfferComponent.cpp b/dGame/dComponents/MissionOfferComponent.cpp index e4cca894..4a4b3c93 100644 --- a/dGame/dComponents/MissionOfferComponent.cpp +++ b/dGame/dComponents/MissionOfferComponent.cpp @@ -79,7 +79,7 @@ void MissionOfferComponent::OnUse(Entity* originator) { void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifiedMissionId) { // First, get the entity's MissionComponent. If there is not one, then we cannot offer missions to this entity. - auto* missionComponent = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = entity->GetComponent(); if (!missionComponent) { Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu", entity->GetObjectID()); diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 4a9d2bf5..d4629942 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -22,7 +22,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) : m_BaseCombatAI = nullptr; - m_BaseCombatAI = reinterpret_cast(m_OwningEntity->GetComponent(eReplicaComponentType::BASE_COMBAT_AI)); + m_BaseCombatAI = m_OwningEntity->GetComponent(); //Try and fix the insane values: if (m_Info.wanderRadius > 5.0f) m_Info.wanderRadius = m_Info.wanderRadius * 0.5f; @@ -322,7 +322,7 @@ foundComponent: } void MovementAIComponent::SetPosition(const NiPoint3& value) { - auto* controllablePhysicsComponent = m_OwningEntity->GetComponent(); + auto controllablePhysicsComponent = m_OwningEntity->GetComponent(); if (controllablePhysicsComponent != nullptr) { controllablePhysicsComponent->SetPosition(value); @@ -330,7 +330,7 @@ void MovementAIComponent::SetPosition(const NiPoint3& value) { return; } - auto* simplePhysicsComponent = m_OwningEntity->GetComponent(); + auto simplePhysicsComponent = m_OwningEntity->GetComponent(); if (simplePhysicsComponent != nullptr) { simplePhysicsComponent->SetPosition(value); @@ -342,7 +342,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) { return; } - auto* controllablePhysicsComponent = m_OwningEntity->GetComponent(); + auto controllablePhysicsComponent = m_OwningEntity->GetComponent(); if (controllablePhysicsComponent != nullptr) { controllablePhysicsComponent->SetRotation(value); @@ -350,7 +350,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) { return; } - auto* simplePhysicsComponent = m_OwningEntity->GetComponent(); + auto simplePhysicsComponent = m_OwningEntity->GetComponent(); if (simplePhysicsComponent != nullptr) { simplePhysicsComponent->SetRotation(value); @@ -358,7 +358,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) { } void MovementAIComponent::SetVelocity(const NiPoint3& value) { - auto* controllablePhysicsComponent = m_OwningEntity->GetComponent(); + auto controllablePhysicsComponent = m_OwningEntity->GetComponent(); if (controllablePhysicsComponent != nullptr) { controllablePhysicsComponent->SetVelocity(value); @@ -366,7 +366,7 @@ void MovementAIComponent::SetVelocity(const NiPoint3& value) { return; } - auto* simplePhysicsComponent = m_OwningEntity->GetComponent(); + auto simplePhysicsComponent = m_OwningEntity->GetComponent(); if (simplePhysicsComponent != nullptr) { simplePhysicsComponent->SetVelocity(value); diff --git a/dGame/dComponents/MovementAIComponent.h b/dGame/dComponents/MovementAIComponent.h index 3c9044aa..7b82edc7 100644 --- a/dGame/dComponents/MovementAIComponent.h +++ b/dGame/dComponents/MovementAIComponent.h @@ -57,7 +57,7 @@ struct MovementAIInfo { */ class MovementAIComponent : public Component { public: - static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI; + inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI; MovementAIComponent(Entity* parentEntity, MovementAIInfo info); ~MovementAIComponent() override; @@ -310,7 +310,7 @@ private: /** * Optional direct link to the combat AI component of the parent entity */ - BaseCombatAIComponent* m_BaseCombatAI = nullptr; + std::shared_ptr m_BaseCombatAI = nullptr; /** * The path the entity is currently following diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index 7eaa551c..a2d44168 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -163,7 +163,7 @@ void PetComponent::OnUse(Entity* originator) { m_Tamer = LWOOBJID_EMPTY; } - auto* inventoryComponent = originator->GetComponent(); + auto inventoryComponent = originator->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -173,7 +173,7 @@ void PetComponent::OnUse(Entity* originator) { return; } - auto* movementAIComponent = m_OwningEntity->GetComponent(); + auto movementAIComponent = m_OwningEntity->GetComponent(); if (movementAIComponent != nullptr) { movementAIComponent->Stop(); @@ -224,7 +224,7 @@ void PetComponent::OnUse(Entity* originator) { imaginationCost = cached->second.imaginationCost; } - auto* destroyableComponent = originator->GetComponent(); + auto destroyableComponent = originator->GetComponent(); if (destroyableComponent == nullptr) { return; @@ -362,10 +362,9 @@ void PetComponent::Update(float deltaTime) { return; } - m_MovementAI = m_OwningEntity->GetComponent(); - if (m_MovementAI == nullptr) { - return; + m_MovementAI = m_OwningEntity->GetComponent(); + if (!m_MovementAI) return; } if (m_TresureTime > 0) { @@ -488,7 +487,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) { if (cached == buildCache.end()) return; - auto* destroyableComponent = tamer->GetComponent(); + auto destroyableComponent = tamer->GetComponent(); if (destroyableComponent == nullptr) return; @@ -549,7 +548,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) { GameMessages::SendPetResponse(m_Tamer, m_OwningEntity->GetObjectID(), 0, 10, 0, tamer->GetSystemAddress()); - auto* inventoryComponent = tamer->GetComponent(); + auto inventoryComponent = tamer->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -607,7 +606,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) { tamer->GetCharacter()->SetPlayerFlag(petFlags.at(m_OwningEntity->GetLOT()), true); } - auto* missionComponent = tamer->GetComponent(); + auto missionComponent = tamer->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::PET_TAMING, m_OwningEntity->GetLOT()); @@ -615,7 +614,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) { SetStatus(1); - auto* characterComponent = tamer->GetComponent(); + auto characterComponent = tamer->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(PetsTamed); } @@ -649,7 +648,7 @@ void PetComponent::RequestSetPetName(std::u16string name) { Game::logger->Log("PetComponent", "Got set pet name (%s)", GeneralUtils::UTF16ToWTF8(name).c_str()); - auto* inventoryComponent = tamer->GetComponent(); + auto inventoryComponent = tamer->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -841,7 +840,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) { m_ItemId = item->GetId(); m_DatabaseId = item->GetSubKey(); - auto* inventoryComponent = item->GetInventory()->GetComponent(); + auto inventoryComponent = item->GetInventory()->GetComponent(); if (inventoryComponent == nullptr) return; @@ -963,7 +962,7 @@ void PetComponent::Deactivate() { } void PetComponent::Release() { - auto* inventoryComponent = GetOwner()->GetComponent(); + auto inventoryComponent = GetOwner()->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -1039,7 +1038,7 @@ void PetComponent::SetAbility(PetAbilityType value) { m_Ability = value; } -PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer) { +std::shared_ptr PetComponent::GetTamingPet(LWOOBJID tamer) { const auto& pair = currentActivities.find(tamer); if (pair == currentActivities.end()) { @@ -1057,7 +1056,7 @@ PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer) { return entity->GetComponent(); } -PetComponent* PetComponent::GetActivePet(LWOOBJID owner) { +std::shared_ptr PetComponent::GetActivePet(LWOOBJID owner) { const auto& pair = activePets.find(owner); if (pair == activePets.end()) { diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index b3d089a9..4eaaa3bc 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -195,14 +195,14 @@ public: * @param tamer the entity that's currently taming * @return the pet component of the entity that's being tamed */ - static PetComponent* GetTamingPet(LWOOBJID tamer); + static std::shared_ptr GetTamingPet(LWOOBJID tamer); /** * Returns the pet that's currently spawned for some entity (if any) * @param owner the owner of the pet that's spawned * @return the pet component of the entity that was spawned by the owner */ - static PetComponent* GetActivePet(LWOOBJID owner); + static std::shared_ptr GetActivePet(LWOOBJID owner); /** * Adds the timer to the owner of this pet to drain imagination at the rate @@ -349,7 +349,7 @@ private: /** * The movement AI component that is related to this pet, required to move it around */ - MovementAIComponent* m_MovementAI; + std::shared_ptr m_MovementAI; /** * Preconditions that need to be met before an entity can tame this pet diff --git a/dGame/dComponents/PossessableComponent.cpp b/dGame/dComponents/PossessableComponent.cpp index 1b137bb1..6172f3e6 100644 --- a/dGame/dComponents/PossessableComponent.cpp +++ b/dGame/dComponents/PossessableComponent.cpp @@ -48,7 +48,7 @@ void PossessableComponent::Dismount() { } void PossessableComponent::OnUse(Entity* originator) { - auto* possessor = originator->GetComponent(); + auto possessor = originator->GetComponent(); if (possessor) { possessor->Mount(m_OwningEntity); } diff --git a/dGame/dComponents/PossessorComponent.cpp b/dGame/dComponents/PossessorComponent.cpp index c1fd5380..347822ac 100644 --- a/dGame/dComponents/PossessorComponent.cpp +++ b/dGame/dComponents/PossessorComponent.cpp @@ -15,7 +15,7 @@ PossessorComponent::~PossessorComponent() { if (m_Possessable != LWOOBJID_EMPTY) { auto* mount = EntityManager::Instance()->GetEntity(m_Possessable); if (mount) { - auto* possessable = mount->GetComponent(); + auto possessable = mount->GetComponent(); if (possessable) { if (possessable->GetIsItemSpawned()) { GameMessages::SendMarkInventoryItemAsActive(m_OwningEntity->GetObjectID(), false, eUnequippableActiveType::MOUNT, GetMountItemID(), m_OwningEntity->GetSystemAddress()); @@ -43,7 +43,7 @@ void PossessorComponent::Mount(Entity* mount) { if (GetIsDismounting() || !mount) return; GameMessages::SendSetMountInventoryID(m_OwningEntity, mount->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS); - auto* possessableComponent = mount->GetComponent(); + auto possessableComponent = mount->GetComponent(); if (possessableComponent) { possessableComponent->SetPossessor(m_OwningEntity->GetObjectID()); SetPossessable(mount->GetObjectID()); @@ -68,7 +68,7 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) { SetIsDismounting(true); if (mount) { - auto* possessableComponent = mount->GetComponent(); + auto possessableComponent = mount->GetComponent(); if (possessableComponent) { possessableComponent->SetPossessor(LWOOBJID_EMPTY); if (forceDismount) possessableComponent->ForceDepossess(); diff --git a/dGame/dComponents/PropertyEntranceComponent.cpp b/dGame/dComponents/PropertyEntranceComponent.cpp index 6fab366b..0fc2cc0c 100644 --- a/dGame/dComponents/PropertyEntranceComponent.cpp +++ b/dGame/dComponents/PropertyEntranceComponent.cpp @@ -26,10 +26,10 @@ PropertyEntranceComponent::PropertyEntranceComponent(uint32_t componentID, Entit } void PropertyEntranceComponent::OnUse(Entity* entity) { - auto* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (!characterComponent) return; - auto* rocket = entity->GetComponent()->RocketEquip(entity); + auto rocket = entity->GetComponent()->RocketEquip(entity); if (!rocket) return; GameMessages::SendPropertyEntranceBegin(m_OwningEntity->GetObjectID(), entity->GetSystemAddress()); @@ -63,7 +63,7 @@ void PropertyEntranceComponent::OnEnterProperty(Entity* entity, uint32_t index, cloneId = query[index].CloneId; } - auto* launcher = m_OwningEntity->GetComponent(); + auto launcher = m_OwningEntity->GetComponent(); if (launcher == nullptr) { return; diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 1520f472..105382a6 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -263,7 +263,7 @@ void PropertyManagementComponent::OnStartBuilding() { SetPrivacyOption(PropertyPrivacyOption::Private); // Cant visit player which is building if (!entrance.empty()) { - auto* rocketPad = entrance[0]->GetComponent(); + auto rocketPad = entrance[0]->GetComponent(); if (rocketPad != nullptr) { zoneId = rocketPad->GetDefaultZone(); @@ -302,7 +302,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N return; } - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -417,7 +417,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet return; } - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent == nullptr) { return; diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index 5c8ee834..6350107f 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -87,7 +87,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, return; } - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -141,8 +141,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, // Make the vehicle a child of the racing controller. m_OwningEntity->AddChild(carEntity); - auto* destroyableComponent = - carEntity->GetComponent(); + auto destroyableComponent = carEntity->GetComponent(); // Setup the vehicle stats. if (destroyableComponent != nullptr) { @@ -151,16 +150,14 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, } // Setup the vehicle as being possessed by the player. - auto* possessableComponent = - carEntity->GetComponent(); + auto possessableComponent = carEntity->GetComponent(); if (possessableComponent != nullptr) { possessableComponent->SetPossessor(player->GetObjectID()); } // Load the vehicle's assemblyPartLOTs for display. - auto* moduleAssemblyComponent = - carEntity->GetComponent(); + auto moduleAssemblyComponent = carEntity->GetComponent(); if (moduleAssemblyComponent) { moduleAssemblyComponent->SetSubKey(item->GetSubKey()); @@ -175,7 +172,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, } // Setup the player as possessing the vehicle. - auto* possessorComponent = player->GetComponent(); + auto possessorComponent = player->GetComponent(); if (possessorComponent != nullptr) { possessorComponent->SetPossessable(carEntity->GetObjectID()); @@ -183,7 +180,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, } // Set the player's current activity as racing. - auto* characterComponent = player->GetComponent(); + auto characterComponent = player->GetComponent(); if (characterComponent != nullptr) { characterComponent->SetIsRacing(true); @@ -293,7 +290,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) { GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true, 0); - auto* destroyableComponent = vehicle->GetComponent(); + auto destroyableComponent = vehicle->GetComponent(); uint32_t respawnImagination = 0; // Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live. // Do not actually change the value yet. Do that on respawn. @@ -318,13 +315,13 @@ void RacingControlComponent::OnRequestDie(Entity* player) { UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendResurrect(vehicle); - auto* destroyableComponent = vehicle->GetComponent(); + auto destroyableComponent = vehicle->GetComponent(); // Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live. if (destroyableComponent) destroyableComponent->SetImagination(respawnImagination); EntityManager::Instance()->SerializeEntity(vehicle); }); - auto* characterComponent = player->GetComponent(); + auto characterComponent = player->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(RacingTimesWrecked); } @@ -386,7 +383,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu m_OwningEntity->GetObjectID(), 2, 0, LWOOBJID_EMPTY, u"", player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) return; @@ -639,8 +636,7 @@ void RacingControlComponent::Update(float deltaTime) { vehicle->SetPosition(player.respawnPosition); vehicle->SetRotation(player.respawnRotation); - auto* destroyableComponent = - vehicle->GetComponent(); + auto destroyableComponent = vehicle->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetImagination(0); @@ -817,8 +813,7 @@ void RacingControlComponent::Update(float deltaTime) { "Best lap time (%llu)", lapTime); } - auto* missionComponent = - playerEntity->GetComponent(); + auto missionComponent = playerEntity->GetComponent(); if (missionComponent != nullptr) { @@ -841,7 +836,7 @@ void RacingControlComponent::Update(float deltaTime) { // Entire race time missionComponent->Progress(eMissionTaskType::RACING, (raceTime) * 1000, (LWOOBJID)eRacingTaskParam::TOTAL_TRACK_TIME); - auto* characterComponent = playerEntity->GetComponent(); + auto characterComponent = playerEntity->GetComponent(); if (characterComponent != nullptr) { characterComponent->TrackRaceCompleted(m_Finished == 1); } diff --git a/dGame/dComponents/RailActivatorComponent.cpp b/dGame/dComponents/RailActivatorComponent.cpp index db1504da..25bdf9b8 100644 --- a/dGame/dComponents/RailActivatorComponent.cpp +++ b/dGame/dComponents/RailActivatorComponent.cpp @@ -43,7 +43,7 @@ RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t component RailActivatorComponent::~RailActivatorComponent() = default; void RailActivatorComponent::OnUse(Entity* originator) { - auto* rebuildComponent = m_OwningEntity->GetComponent(); + auto rebuildComponent = m_OwningEntity->GetComponent(); if (rebuildComponent != nullptr && rebuildComponent->GetState() != eRebuildState::COMPLETED) return; @@ -116,7 +116,7 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) { true, true, true, true, true, true, true ); - auto* rebuildComponent = m_OwningEntity->GetComponent(); + auto rebuildComponent = m_OwningEntity->GetComponent(); if (rebuildComponent != nullptr) { // Set back reset time diff --git a/dGame/dComponents/RebuildComponent.cpp b/dGame/dComponents/RebuildComponent.cpp index 15b3a255..d224402f 100644 --- a/dGame/dComponents/RebuildComponent.cpp +++ b/dGame/dComponents/RebuildComponent.cpp @@ -194,7 +194,7 @@ void RebuildComponent::Update(float deltaTime) { if (m_TimeBeforeDrain <= 0.0f) { m_TimeBeforeDrain = m_CompleteTime / static_cast(m_TakeImagination); - DestroyableComponent* destComp = builder->GetComponent(); + auto destComp = builder->GetComponent(); if (!destComp) break; int newImagination = destComp->GetImagination(); @@ -400,7 +400,7 @@ void RebuildComponent::StartRebuild(Entity* user) { if (m_State == eRebuildState::OPEN || m_State == eRebuildState::COMPLETED || m_State == eRebuildState::INCOMPLETE) { m_Builder = user->GetObjectID(); - auto* character = user->GetComponent(); + auto character = user->GetComponent(); character->SetCurrentActivity(eGameActivity::QUICKBUILDING); EntityManager::Instance()->SerializeEntity(user); @@ -412,7 +412,7 @@ void RebuildComponent::StartRebuild(Entity* user) { m_StateDirty = true; EntityManager::Instance()->SerializeEntity(m_OwningEntity); - auto* movingPlatform = m_OwningEntity->GetComponent(); + auto movingPlatform = m_OwningEntity->GetComponent(); if (movingPlatform != nullptr) { movingPlatform->OnRebuildInitilized(); } @@ -434,7 +434,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) { return; } - auto* characterComponent = user->GetComponent(); + auto characterComponent = user->GetComponent(); if (characterComponent != nullptr) { characterComponent->SetCurrentActivity(eGameActivity::NONE); characterComponent->TrackRebuildComplete(); @@ -478,12 +478,12 @@ void RebuildComponent::CompleteRebuild(Entity* user) { for (const auto memberId : team->members) { // progress missions for all team members auto* member = EntityManager::Instance()->GetEntity(memberId); if (member) { - auto* missionComponent = member->GetComponent(); + auto missionComponent = member->GetComponent(); if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId); } } } else{ - auto* missionComponent = builder->GetComponent(); + auto missionComponent = builder->GetComponent(); if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId); } LootGenerator::Instance().DropActivityLoot(builder, m_OwningEntity, m_ActivityId, 1); @@ -503,7 +503,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) { m_OwningEntity->TriggerEvent(eTriggerEventType::REBUILD_COMPLETE, user); - auto* movingPlatform = m_OwningEntity->GetComponent(); + auto movingPlatform = m_OwningEntity->GetComponent(); if (movingPlatform != nullptr) { movingPlatform->OnCompleteRebuild(); } @@ -588,7 +588,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR return; } - CharacterComponent* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (characterComponent) { characterComponent->SetCurrentActivity(eGameActivity::NONE); EntityManager::Instance()->SerializeEntity(entity); diff --git a/dGame/dComponents/RenderComponent.cpp b/dGame/dComponents/RenderComponent.cpp index f59e116d..feedfd85 100644 --- a/dGame/dComponents/RenderComponent.cpp +++ b/dGame/dComponents/RenderComponent.cpp @@ -214,7 +214,7 @@ float RenderComponent::GetAnimationTime(Entity* self, const std::string& animati float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) { float returnlength = 0.0f; if (!self) return returnlength; - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (!renderComponent) return returnlength; auto* animationsTable = CDClientManager::Instance().GetTable(); diff --git a/dGame/dComponents/RocketLaunchLupComponent.cpp b/dGame/dComponents/RocketLaunchLupComponent.cpp index 87e969dd..442ee09c 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.cpp +++ b/dGame/dComponents/RocketLaunchLupComponent.cpp @@ -17,7 +17,7 @@ RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(p RocketLaunchLupComponent::~RocketLaunchLupComponent() {} void RocketLaunchLupComponent::OnUse(Entity* originator) { - auto* rocket = originator->GetComponent()->RocketEquip(originator); + auto rocket = originator->GetComponent()->RocketEquip(originator); if (!rocket) return; // the LUP world menu is just the property menu, the client knows how to handle it @@ -25,7 +25,7 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) { } void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) { - auto* rocketLaunchpadControlComponent = m_OwningEntity->GetComponent(); + auto rocketLaunchpadControlComponent = m_OwningEntity->GetComponent(); if (!rocketLaunchpadControlComponent) return; rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0); diff --git a/dGame/dComponents/RocketLaunchpadControlComponent.cpp b/dGame/dComponents/RocketLaunchpadControlComponent.cpp index c4af8a4a..5376faa7 100644 --- a/dGame/dComponents/RocketLaunchpadControlComponent.cpp +++ b/dGame/dComponents/RocketLaunchpadControlComponent.cpp @@ -50,7 +50,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId, } // This also gets triggered by a proximity monitor + item equip, I will set that up when havok is ready - auto* characterComponent = originator->GetComponent(); + auto characterComponent = originator->GetComponent(); auto* character = originator->GetCharacter(); if (!characterComponent || !character) return; @@ -89,18 +89,18 @@ void RocketLaunchpadControlComponent::OnUse(Entity* originator) { // instead we let their OnUse handlers do their things // which components of an Object have their OnUse called when using them // so we don't need to call it here - auto* propertyEntrance = m_OwningEntity->GetComponent(); + auto propertyEntrance = m_OwningEntity->GetComponent(); if (propertyEntrance) { return; } - auto* rocketLaunchLUP = m_OwningEntity->GetComponent(); + auto rocketLaunchLUP = m_OwningEntity->GetComponent(); if (rocketLaunchLUP) { return; } // No rocket no launch - auto* rocket = originator->GetComponent()->RocketEquip(originator); + auto rocket = originator->GetComponent()->RocketEquip(originator); if (!rocket) { return; } diff --git a/dGame/dComponents/ScriptedActivityComponent.cpp b/dGame/dComponents/ScriptedActivityComponent.cpp index 88cc726c..c74c77c7 100644 --- a/dGame/dComponents/ScriptedActivityComponent.cpp +++ b/dGame/dComponents/ScriptedActivityComponent.cpp @@ -53,7 +53,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit } } - auto* destroyableComponent = m_OwningEntity->GetComponent(); + auto destroyableComponent = m_OwningEntity->GetComponent(); if (destroyableComponent) { // check for LMIs and set the loot LMIs @@ -305,7 +305,7 @@ bool ScriptedActivityComponent::IsValidActivity(Entity* player) { // Makes it so that scripted activities with an unimplemented map cannot be joined /*if (player->GetGMLevel() < eGameMasterLevel::DEVELOPER && (m_ActivityInfo.instanceMapID == 1302 || m_ActivityInfo.instanceMapID == 1301)) { if (m_OwningEntity->GetLOT() == 4860) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); missionComponent->CompleteMission(229); } @@ -354,7 +354,7 @@ bool ScriptedActivityComponent::TakeCost(Entity* player) const { if (m_ActivityInfo.optionalCostLOT <= 0 || m_ActivityInfo.optionalCostCount <= 0) return true; - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (inventoryComponent == nullptr) return false; @@ -555,7 +555,7 @@ void ActivityInstance::StartZone() { } void ActivityInstance::RewardParticipant(Entity* participant) { - auto* missionComponent = participant->GetComponent(); + auto missionComponent = participant->GetComponent(); if (missionComponent) { missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID); } diff --git a/dGame/dComponents/SkillComponent.cpp b/dGame/dComponents/SkillComponent.cpp index 95cbe3cd..7834674e 100644 --- a/dGame/dComponents/SkillComponent.cpp +++ b/dGame/dComponents/SkillComponent.cpp @@ -193,7 +193,7 @@ void SkillComponent::Reset() { void SkillComponent::Interrupt() { // TODO: need to check immunities on the destroyable component, but they aren't implemented - auto* combat = m_OwningEntity->GetComponent(); + auto combat = m_OwningEntity->GetComponent(); if (combat != nullptr && combat->GetStunImmune()) return; for (const auto& behavior : this->m_managedBehaviors) { diff --git a/dGame/dComponents/SwitchComponent.h b/dGame/dComponents/SwitchComponent.h index fde3cfc0..eea08e51 100644 --- a/dGame/dComponents/SwitchComponent.h +++ b/dGame/dComponents/SwitchComponent.h @@ -75,7 +75,7 @@ private: /** * Attached rebuild component. */ - RebuildComponent* m_Rebuild; + std::shared_ptr m_Rebuild; /** * If the switch is on or off. diff --git a/dGame/dComponents/TriggerComponent.cpp b/dGame/dComponents/TriggerComponent.cpp index fe141a4d..ca995c24 100644 --- a/dGame/dComponents/TriggerComponent.cpp +++ b/dGame/dComponents/TriggerComponent.cpp @@ -196,7 +196,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg } void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){ - auto* triggerComponent = targetEntity->GetComponent(); + auto triggerComponent = targetEntity->GetComponent(); if (!triggerComponent) { Game::logger->LogDebug("TriggerComponent::HandleToggleTrigger", "Trigger component not found!"); return; @@ -205,7 +205,7 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg } void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){ - auto* rebuildComponent = targetEntity->GetComponent(); + auto rebuildComponent = targetEntity->GetComponent(); if (!rebuildComponent) { Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!"); return; @@ -237,7 +237,7 @@ void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector argArray){ if (argArray.size() < 3) return; - auto* phantomPhysicsComponent = m_OwningEntity->GetComponent(); + auto phantomPhysicsComponent = m_OwningEntity->GetComponent(); if (!phantomPhysicsComponent) { Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!"); return; @@ -254,7 +254,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vectorGetComponent(); + auto phantomPhysicsComponent = m_OwningEntity->GetComponent(); if (!phantomPhysicsComponent) { Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!"); return; @@ -334,7 +334,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vectorGetComponent(); + auto missionComponent = targetEntity->GetComponent(); if (!missionComponent){ Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!"); return; @@ -353,7 +353,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vectorGetComponent(); + auto skillComponent = targetEntity->GetComponent(); if (!skillComponent) { Game::logger->LogDebug("TriggerComponent::HandleCastSkill", "Skill component not found!"); return; @@ -364,7 +364,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){ } void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector argArray) { - auto* phantomPhysicsComponent = targetEntity->GetComponent(); + auto phantomPhysicsComponent = targetEntity->GetComponent(); if (!phantomPhysicsComponent) { Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!"); return; @@ -399,7 +399,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v } void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) { - auto* phantomPhysicsComponent = targetEntity->GetComponent(); + auto phantomPhysicsComponent = targetEntity->GetComponent(); if (!phantomPhysicsComponent) { Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!"); return; diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index be751598..3b10b350 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -110,7 +110,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System player->ConstructLimboEntities(); } - InventoryComponent* inv = entity->GetComponent(); + auto inv = entity->GetComponent(); if (inv) { auto items = inv->GetEquippedItems(); for (auto pair : items) { @@ -120,13 +120,13 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System } } - auto* destroyable = entity->GetComponent(); + auto destroyable = entity->GetComponent(); destroyable->SetImagination(destroyable->GetImagination()); EntityManager::Instance()->SerializeEntity(entity); std::vector racingControllers = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL); for (Entity* racingController : racingControllers) { - auto* racingComponent = racingController->GetComponent(); + auto racingComponent = racingController->GetComponent(); if (racingComponent != nullptr) { racingComponent->OnPlayerLoaded(entity); } @@ -243,13 +243,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System case eGameMessageType::REQUEST_RESURRECT: { GameMessages::SendResurrect(entity); - /*auto* dest = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); - if (dest) { - dest->SetHealth(4); - dest->SetArmor(0); - dest->SetImagination(6); - EntityManager::Instance()->SerializeEntity(entity); - }*/ break; } case eGameMessageType::HANDLE_HOT_PROPERTY_DATA: { @@ -263,7 +256,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System message.Deserialize(inStream); - auto* skill_component = entity->GetComponent(); + auto skill_component = entity->GetComponent(); if (skill_component != nullptr) { auto* bs = new RakNet::BitStream((unsigned char*)message.sBitStream.c_str(), message.sBitStream.size(), false); @@ -282,7 +275,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System if (startSkill.skillID == 1561 || startSkill.skillID == 1562 || startSkill.skillID == 1541) return; - MissionComponent* comp = entity->GetComponent(); + auto comp = entity->GetComponent(); if (comp) { comp->Progress(eMissionTaskType::USE_SKILL, startSkill.skillID); } @@ -295,12 +288,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System if (behaviorId > 0) { RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)startSkill.sBitStream.c_str(), startSkill.sBitStream.size(), false); - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); success = skillComponent->CastPlayerSkill(behaviorId, startSkill.uiSkillHandle, bs, startSkill.optionalTargetID, startSkill.skillID); if (success && entity->GetCharacter()) { - DestroyableComponent* destComp = entity->GetComponent(); + auto destComp = entity->GetComponent(); destComp->SetImagination(destComp->GetImagination() - skillTable->GetSkillByID(startSkill.skillID).imaginationcost); } @@ -357,7 +350,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System if (usr != nullptr) { RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)sync.sBitStream.c_str(), sync.sBitStream.size(), false); - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); skillComponent->SyncPlayerSkill(sync.uiSkillHandle, sync.uiBehaviorHandle, bs); diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 12d1a5ef..0d3b192d 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -935,10 +935,10 @@ void GameMessages::SendResurrect(Entity* entity) { // and just make sure the client has time to be ready. constexpr float respawnTime = 3.66700005531311f + 0.5f; entity->AddCallbackTimer(respawnTime, [=]() { - auto* destroyableComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); if (destroyableComponent != nullptr && entity->GetLOT() == 1) { - auto* levelComponent = entity->GetComponent(); + auto levelComponent = entity->GetComponent(); if (levelComponent) { int32_t healthToRestore = levelComponent->GetLevel() >= 45 ? 8 : 4; if (healthToRestore > destroyableComponent->GetMaxHealth()) healthToRestore = destroyableComponent->GetMaxHealth(); @@ -952,7 +952,7 @@ void GameMessages::SendResurrect(Entity* entity) { }); - auto cont = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); + auto cont = entity->GetComponent(); if (cont && entity->GetLOT() == 1) { cont->SetPosition(entity->GetRespawnPosition()); cont->SetRotation(entity->GetRespawnRotation()); @@ -1149,7 +1149,7 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo bitStream.Write(position.y); bitStream.Write(position.z); - auto con = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); + auto con = entity->GetComponent(); if (con) { auto rot = con->GetRotation(); bitStream.Write(rot.x); @@ -1284,7 +1284,7 @@ void GameMessages::SendVendorStatusUpdate(Entity* entity, const SystemAddress& s CBITSTREAM; CMSGHEADER; - VendorComponent* vendor = static_cast(entity->GetComponent(eReplicaComponentType::VENDOR)); + auto vendor = entity->GetComponent(); if (!vendor) return; std::map vendorItems = vendor->GetInventory(); @@ -1406,7 +1406,7 @@ void GameMessages::SendMoveInventoryBatch(Entity* entity, uint32_t stackCount, i CBITSTREAM; CMSGHEADER; - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; Item* itemStack = inv->FindItemById(iObjID); @@ -2182,7 +2182,7 @@ void GameMessages::HandleUnUseModel(RakNet::BitStream* inStream, Entity* entity, LWOOBJID objIdToAddToInventory{}; inStream->Read(unknown); inStream->Read(objIdToAddToInventory); - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent) { auto* inventory = inventoryComponent->GetInventory(eInventoryType::MODELS_IN_BBB); auto* item = inventory->FindItemById(objIdToAddToInventory); @@ -2244,7 +2244,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity* entity = entites[0]; */ - auto* propertyVendorComponent = static_cast(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR)); + auto propertyVendorComponent = entity->GetComponent(); if (propertyVendorComponent != nullptr) { propertyVendorComponent->OnQueryPropertyData(entity, sysAddr); @@ -2256,7 +2256,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity* entity = entites[0]; */ - auto* propertyManagerComponent = static_cast(entity->GetComponent(eReplicaComponentType::PROPERTY_MANAGEMENT)); + auto propertyManagerComponent = entity->GetComponent(); if (propertyManagerComponent != nullptr) { propertyManagerComponent->OnQueryPropertyData(entity, sysAddr); @@ -2422,7 +2422,7 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity* Game::logger->Log("BBB", "Load item request for: %lld", previousItemID); LWOOBJID newId = previousItemID; - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent) { auto* inventory = inventoryComponent->GetInventory(eInventoryType::MODELS); auto* itemToMove = inventory->FindItemById(previousItemID); @@ -2776,7 +2776,7 @@ void GameMessages::HandlePropertyEntranceSync(RakNet::BitStream* inStream, Entit auto* player = Player::GetPlayer(sysAddr); - auto* entranceComponent = entity->GetComponent(); + auto entranceComponent = entity->GetComponent(); if (entranceComponent == nullptr) return; @@ -2803,7 +2803,7 @@ void GameMessages::HandleEnterProperty(RakNet::BitStream* inStream, Entity* enti auto* player = Player::GetPlayer(sysAddr); - auto* entranceComponent = entity->GetComponent(); + auto entranceComponent = entity->GetComponent(); if (entranceComponent != nullptr) { entranceComponent->OnEnterProperty(player, index, returnToZone, sysAddr); return; @@ -2820,7 +2820,7 @@ void GameMessages::HandleSetConsumableItem(RakNet::BitStream* inStream, Entity* inStream->Read(lot); - auto* inventory = entity->GetComponent(); + auto inventory = entity->GetComponent(); if (inventory == nullptr) return; @@ -3719,7 +3719,7 @@ void GameMessages::SendPetNameChanged(LWOOBJID objectId, int32_t moderationStatu void GameMessages::HandleClientExitTamingMinigame(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { bool bVoluntaryExit = inStream->ReadBit(); - auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); + auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); if (petComponent == nullptr) { return; @@ -3729,7 +3729,7 @@ void GameMessages::HandleClientExitTamingMinigame(RakNet::BitStream* inStream, E } void GameMessages::HandleStartServerPetMinigameTimer(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); + auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); if (petComponent == nullptr) { return; @@ -3757,7 +3757,7 @@ void GameMessages::HandlePetTamingTryBuild(RakNet::BitStream* inStream, Entity* clientFailed = inStream->ReadBit(); - auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); + auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); if (petComponent == nullptr) { return; @@ -3771,7 +3771,7 @@ void GameMessages::HandleNotifyTamingBuildSuccess(RakNet::BitStream* inStream, E inStream->Read(position); - auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); + auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); if (petComponent == nullptr) { return; @@ -3792,7 +3792,7 @@ void GameMessages::HandleRequestSetPetName(RakNet::BitStream* inStream, Entity* name.push_back(character); } - auto* petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); + auto petComponent = PetComponent::GetTamingPet(entity->GetObjectID()); if (petComponent == nullptr) { petComponent = PetComponent::GetActivePet(entity->GetObjectID()); @@ -3818,7 +3818,7 @@ void GameMessages::HandleCommandPet(RakNet::BitStream* inStream, Entity* entity, inStream->Read(iTypeID); overrideObey = inStream->ReadBit(); - auto* petComponent = entity->GetComponent(); + auto petComponent = entity->GetComponent(); if (petComponent == nullptr) { return; @@ -3832,7 +3832,7 @@ void GameMessages::HandleDespawnPet(RakNet::BitStream* inStream, Entity* entity, bDeletePet = inStream->ReadBit(); - auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID()); + auto petComponent = PetComponent::GetActivePet(entity->GetObjectID()); if (petComponent == nullptr) { return; @@ -3884,13 +3884,13 @@ void GameMessages::HandleMessageBoxResponse(RakNet::BitStream* inStream, Entity* entity->OnMessageBoxResponse(userEntity, iButton, identifier, userData); - auto* scriptedActivityComponent = entity->GetComponent(); + auto scriptedActivityComponent = entity->GetComponent(); if (scriptedActivityComponent != nullptr) { scriptedActivityComponent->HandleMessageBoxResponse(userEntity, GeneralUtils::UTF16ToWTF8(identifier)); } - auto* racingControlComponent = entity->GetComponent(); + auto racingControlComponent = entity->GetComponent(); if (racingControlComponent != nullptr) { racingControlComponent->HandleMessageBoxResponse(userEntity, iButton, GeneralUtils::UTF16ToWTF8(identifier)); @@ -4056,7 +4056,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e // If we aren't possessing somethings, the don't do anything if (objectId != LWOOBJID_EMPTY) { - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); auto* mount = EntityManager::Instance()->GetEntity(objectId); // make sure we have the things we need and they aren't null if (possessorComponent && mount) { @@ -4066,7 +4066,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e possessorComponent->SetPossessableType(ePossessionType::NO_POSSESSION); // character related things - auto* character = entity->GetComponent(); + auto character = entity->GetComponent(); if (character) { // If we had an active item turn it off if (possessorComponent->GetMountItemID() != LWOOBJID_EMPTY) GameMessages::SendMarkInventoryItemAsActive(entity->GetObjectID(), false, eUnequippableActiveType::MOUNT, possessorComponent->GetMountItemID(), entity->GetSystemAddress()); @@ -4074,11 +4074,11 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e } // Set that the controllabel phsyics comp is teleporting - auto* controllablePhysicsComponent = entity->GetComponent(); + auto controllablePhysicsComponent = entity->GetComponent(); if (controllablePhysicsComponent) controllablePhysicsComponent->SetIsTeleporting(true); // Call dismoint on the possessable comp to let it handle killing the possessable - auto* possessableComponent = mount->GetComponent(); + auto possessableComponent = mount->GetComponent(); if (possessableComponent) possessableComponent->Dismount(); // Update the entity that was possessing @@ -4102,7 +4102,7 @@ void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Enti //Racing void GameMessages::HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - auto* moduleAssemblyComponent = entity->GetComponent(); + auto moduleAssemblyComponent = entity->GetComponent(); Game::logger->Log("HandleModuleAssemblyQueryData", "Got Query from %i", entity->GetLOT()); @@ -4138,7 +4138,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity* return; } - auto* racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); + auto racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); if (racingControlComponent == nullptr) { return; @@ -4188,12 +4188,12 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity, auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); - auto* racingControlComponent = zoneController->GetComponent(); + auto racingControlComponent = zoneController->GetComponent(); Game::logger->Log("HandleRequestDie", "Got die request: %i", entity->GetLOT()); if (racingControlComponent != nullptr) { - auto* possessableComponent = entity->GetComponent(); + auto possessableComponent = entity->GetComponent(); if (possessableComponent != nullptr) { entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); @@ -4231,7 +4231,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); - auto* racingControlComponent = zoneController->GetComponent(); + auto racingControlComponent = zoneController->GetComponent(); Game::logger->Log("HandleRacingPlayerInfoResetFinished", "Got finished: %i", entity->GetLOT()); @@ -4293,7 +4293,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in return; } - auto* possessableComponent = entity->GetComponent(); + auto possessableComponent = entity->GetComponent(); if (possessableComponent != nullptr) { entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); @@ -4303,7 +4303,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in } } - auto* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(RacingImaginationPowerUpsCollected); } @@ -4630,7 +4630,7 @@ void GameMessages::HandleRequestMoveItemBetweenInventoryTypes(RakNet::BitStream* return; } - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent != nullptr) { if (itemID != LWOOBJID_EMPTY) { @@ -4639,7 +4639,7 @@ void GameMessages::HandleRequestMoveItemBetweenInventoryTypes(RakNet::BitStream* if (!item) return; // Despawn the pet if we are moving that pet to the vault. - auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID()); + auto petComponent = PetComponent::GetActivePet(entity->GetObjectID()); if (petComponent && petComponent->GetDatabaseId() == item->GetSubKey()) { inventoryComponent->DespawnPet(); } @@ -4723,7 +4723,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); if (!player) return; - auto* propertyVendorComponent = static_cast(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR)); + auto propertyVendorComponent = entity->GetComponent(); if (propertyVendorComponent != nullptr) { propertyVendorComponent->OnBuyFromVendor(player, bConfirmed, item, count); @@ -4733,10 +4733,10 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti const auto isCommendationVendor = entity->GetLOT() == 13806; - auto* vend = entity->GetComponent(); + auto vend = entity->GetComponent(); if (!vend && !isCommendationVendor) return; - auto* inv = player->GetComponent(); + auto inv = player->GetComponent(); if (!inv) return; if (!isCommendationVendor && !vend->SellsItem(item)) { @@ -4764,7 +4764,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti return; } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) { return; @@ -4827,10 +4827,10 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit if (!player) return; Character* character = player->GetCharacter(); if (!character) return; - InventoryComponent* inv = static_cast(player->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = player->GetComponent(); if (!inv) return; - VendorComponent* vend = static_cast(entity->GetComponent(eReplicaComponentType::VENDOR)); + auto vend = entity->GetComponent(); if (!vend) return; Item* item = inv->FindItemById(iObjID); @@ -4877,10 +4877,10 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity* if (!player) return; Character* character = player->GetCharacter(); if (!character) return; - InventoryComponent* inv = static_cast(player->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = player->GetComponent(); if (!inv) return; - VendorComponent* vend = static_cast(entity->GetComponent(eReplicaComponentType::VENDOR)); + auto vend = entity->GetComponent(); if (!vend) return; Item* item = inv->FindItemById(iObjID); @@ -4974,7 +4974,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity LWOCLONEID cloneId = 0; LWOMAPID mapId = 0; - auto* rocketPad = entity->GetComponent(); + auto rocketPad = entity->GetComponent(); if (rocketPad == nullptr) return; @@ -5031,7 +5031,7 @@ void GameMessages::HandleRebuildCancel(RakNet::BitStream* inStream, Entity* enti inStream->Read(bEarlyRelease); inStream->Read(userID); - RebuildComponent* rebComp = static_cast(entity->GetComponent(eReplicaComponentType::QUICK_BUILD)); + auto rebComp = entity->GetComponent(); if (!rebComp) return; rebComp->CancelRebuild(EntityManager::Instance()->GetEntity(userID), eQuickBuildFailReason::CANCELED_EARLY); @@ -5064,7 +5064,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, if (bIsMultiInteractUse) { if (multiInteractType == 0) { - auto* missionOfferComponent = static_cast(interactedObject->GetComponent(eReplicaComponentType::MISSION_OFFER)); + auto missionOfferComponent = interactedObject->GetComponent(); if (missionOfferComponent != nullptr) { missionOfferComponent->OfferMissions(entity, multiInteractID); @@ -5077,7 +5077,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, } //Perform use task if possible: - auto missionComponent = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = entity->GetComponent(); if (missionComponent == nullptr) return; @@ -5099,7 +5099,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity) if (emoteID == 0) return; std::string sAnimationName = "deaded"; //Default name in case we fail to get the emote - MissionComponent* missionComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); if (!missionComponent) return; if (targetID != LWOOBJID_EMPTY) { @@ -5143,7 +5143,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E if (!user) return; Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); if (!character) return; - InventoryComponent* inv = static_cast(character->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = character->GetComponent(); if (!inv) return; auto* item = inv->FindItemById(modelID); @@ -5186,7 +5186,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e inStream->Read(isDefaultReward); if (isDefaultReward) inStream->Read(reward); - MissionComponent* missionComponent = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = entity->GetComponent(); if (!missionComponent) { Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle RespondToMission", playerID); return; @@ -5229,7 +5229,7 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en } // Get the player's mission component - MissionComponent* missionComponent = static_cast(player->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = player->GetComponent(); if (!missionComponent) { Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID()); return; @@ -5253,7 +5253,7 @@ void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entit auto* player = EntityManager::Instance()->GetEntity(playerId); - auto* missionOfferComponent = static_cast(entity->GetComponent(eReplicaComponentType::MISSION_OFFER)); + auto missionOfferComponent = entity->GetComponent(); if (missionOfferComponent != nullptr) { missionOfferComponent->OfferMissions(player, 0); @@ -5267,16 +5267,16 @@ void GameMessages::HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* e Entity* player = EntityManager::Instance()->GetEntity(playerID); if (!player || !entity || entity->GetCollectibleID() == 0) return; - MissionComponent* missionComponent = static_cast(player->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = player->GetComponent(); if (missionComponent) { missionComponent->Progress(eMissionTaskType::COLLECTION, entity->GetLOT(), entity->GetObjectID()); } } void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity) { - auto* levelComp = entity->GetComponent(); + auto levelComp = entity->GetComponent(); if (!levelComp) return; - auto* character = entity->GetComponent(); + auto character = entity->GetComponent(); if (!character) return; //Update our character's level in memory: @@ -5284,7 +5284,7 @@ void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* levelComp->HandleLevelUp(); - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent != nullptr) { auto* inventory = inventoryComponent->GetInventory(ITEMS); @@ -5370,7 +5370,7 @@ void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity) inStream->Read(immediate); //twice? inStream->Read(objectID); - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; Item* item = inv->FindItemById(objectID); @@ -5389,7 +5389,7 @@ void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity inStream->Read(immediate); inStream->Read(objectID); - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; auto* item = inv->FindItemById(objectID); @@ -5464,7 +5464,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En inStream->Read(iTradeIDIsDefault); if (iTradeIDIsDefault) inStream->Read(iTradeID); - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; auto* item = inv->FindItemById(iObjID); @@ -5485,7 +5485,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En item->SetCount(item->GetCount() - iStackCount, true); EntityManager::Instance()->SerializeEntity(entity); - auto* missionComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::GATHER, item->GetLot(), LWOOBJID_EMPTY, "", -iStackCount); @@ -5507,7 +5507,7 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity inStream->Read(responseCode); inStream->Read(slot); - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; auto* item = inv->FindItemById(iObjID); @@ -5584,7 +5584,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* if (!user) return; Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); if (!character) return; - InventoryComponent* inv = static_cast(character->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = character->GetComponent(); if (!inv) return; Game::logger->Log("GameMessages", "Build finished"); @@ -5639,7 +5639,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* inv->AddItem(8092, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config); } - auto* missionComponent = character->GetComponent(); + auto missionComponent = character->GetComponent(); if (entity->GetLOT() != 9980 || Game::server->GetZoneID() != 1200) { if (missionComponent != nullptr) { @@ -5649,7 +5649,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* } } - ScriptComponent* script = static_cast(entity->GetComponent(eReplicaComponentType::SCRIPT)); + auto script = entity->GetComponent(); for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) { script->OnModularBuildExit(entity, character, count >= 3, modList); @@ -5672,7 +5672,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti if (!user) return; Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); if (!character) return; - InventoryComponent* inv = static_cast(character->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = character->GetComponent(); if (!inv) return; /** @@ -5790,7 +5790,7 @@ void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, E inStream->Read(templateID); - InventoryComponent* inv = static_cast(character->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = character->GetComponent(); if (!inv) return; auto* item = inv->FindItemByLot(templateID, TEMP_MODELS); @@ -5842,13 +5842,13 @@ void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity) } void GameMessages::HandlePushEquippedItemsState(RakNet::BitStream* inStream, Entity* entity) { - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; inv->PushEquippedItems(); } void GameMessages::HandlePopEquippedItemsState(RakNet::BitStream* inStream, Entity* entity) { - InventoryComponent* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; inv->PopEquippedItems(); EntityManager::Instance()->SerializeEntity(entity); // so it updates on client side @@ -5860,7 +5860,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity* inStream->Read(itemConsumed); - auto* inventory = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inventory = entity->GetComponent(); if (inventory == nullptr) { return; @@ -5874,7 +5874,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity* item->Consume(); - auto* missions = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto missions = entity->GetComponent(); if (missions != nullptr) { missions->Progress(eMissionTaskType::USE_ITEM, itemLot); } @@ -5886,7 +5886,7 @@ void GameMessages::HandleUseNonEquipmentItem(RakNet::BitStream* inStream, Entity inStream->Read(itemConsumed); - auto* inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; @@ -5921,7 +5921,7 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit if (type == 0) { // join if (value != 0) { for (Entity* scriptedAct : scriptedActs) { - ScriptedActivityComponent* comp = static_cast(scriptedAct->GetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY)); + auto comp = scriptedAct->GetComponent(); if (!comp) continue; if (comp->GetActivityID() == value) { comp->PlayerJoin(entity); @@ -5932,7 +5932,7 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit } } else if (type == 1) { // ready/unready for (Entity* scriptedAct : scriptedActs) { - ScriptedActivityComponent* comp = static_cast(scriptedAct->GetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY)); + auto comp = scriptedAct->GetComponent(); if (!comp) continue; if (comp->PlayerIsInQueue(entity)) { comp->PlayerReady(entity, value); @@ -6052,7 +6052,7 @@ void GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR); for (const auto* possibleRail : possibleRails) { - const auto* rail = possibleRail->GetComponent(); + const auto rail = possibleRail->GetComponent(); if (rail != nullptr) { rail->OnRailMovementReady(entity); } @@ -6064,7 +6064,7 @@ void GameMessages::HandleCancelRailMovement(RakNet::BitStream* inStream, Entity* const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR); for (const auto* possibleRail : possibleRails) { - auto* rail = possibleRail->GetComponent(); + auto rail = possibleRail->GetComponent(); if (rail != nullptr) { rail->OnCancelRailMovement(entity); } @@ -6113,7 +6113,7 @@ void GameMessages::HandleModifyPlayerZoneStatistic(RakNet::BitStream* inStream, } // Notify the character component that something's changed - auto* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (characterComponent != nullptr) { characterComponent->HandleZoneStatisticsUpdate(zone, statisticsName, value); } @@ -6130,7 +6130,7 @@ void GameMessages::HandleUpdatePlayerStatistic(RakNet::BitStream* inStream, Enti updateValue = 1; } - auto* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic((StatisticID)updateID, (uint64_t)std::max(updateValue, int64_t(0))); } diff --git a/dGame/dInventory/Item.cpp b/dGame/dInventory/Item.cpp index 6f3af073..c47cf520 100644 --- a/dGame/dInventory/Item.cpp +++ b/dGame/dInventory/Item.cpp @@ -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(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; diff --git a/dGame/dInventory/ItemSet.cpp b/dGame/dInventory/ItemSet.cpp index 4dd3650b..055a96a8 100644 --- a/dGame/dInventory/ItemSet.cpp +++ b/dGame/dInventory/ItemSet.cpp @@ -125,8 +125,8 @@ void ItemSet::OnEquip(const LOT lot) { return; } - auto* skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent(); - auto* missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent(); + auto skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent(); + auto missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent(); for (const auto skill : skillSet) { auto* skillTable = CDClientManager::Instance().GetTable(); diff --git a/dGame/dInventory/ItemSetPassiveAbility.cpp b/dGame/dInventory/ItemSetPassiveAbility.cpp index bf7c19cb..91f7c916 100644 --- a/dGame/dInventory/ItemSetPassiveAbility.cpp +++ b/dGame/dInventory/ItemSetPassiveAbility.cpp @@ -37,8 +37,8 @@ void ItemSetPassiveAbility::Activate(Entity* target) { return; } - auto* destroyableComponent = m_Parent->GetComponent(); - auto* skillComponent = m_Parent->GetComponent(); + auto destroyableComponent = m_Parent->GetComponent(); + auto skillComponent = m_Parent->GetComponent(); if (destroyableComponent == nullptr || skillComponent == nullptr) { return; @@ -196,8 +196,8 @@ std::vector ItemSetPassiveAbility::FindAbilities(uint32_t } void ItemSetPassiveAbility::OnEnemySmshed(Entity* target) { - auto* destroyableComponent = m_Parent->GetComponent(); - auto* skillComponent = m_Parent->GetComponent(); + auto destroyableComponent = m_Parent->GetComponent(); + auto skillComponent = m_Parent->GetComponent(); if (destroyableComponent == nullptr || skillComponent == nullptr) { return; diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index afde876c..9f77ad5e 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -319,12 +319,12 @@ void Mission::Complete(const bool yieldRewards) { return; } - auto* characterComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); if (characterComponent != nullptr) { characterComponent->TrackMissionCompletion(!info->isMission); } - auto* missionComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); missionComponent->Progress(eMissionTaskType::META, info->id); @@ -372,7 +372,7 @@ void Mission::CheckCompletion() { void Mission::Catchup() { auto* entity = GetAssociate(); - auto* inventory = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inventory = entity->GetComponent(); for (auto* task : m_Tasks) { const auto type = task->GetType(); @@ -414,11 +414,11 @@ void Mission::YieldRewards() { auto* character = GetUser()->GetLastUsedChar(); - auto* inventoryComponent = entity->GetComponent(); - auto* levelComponent = entity->GetComponent(); - auto* characterComponent = entity->GetComponent(); - auto* destroyableComponent = entity->GetComponent(); - auto* missionComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); + auto levelComponent = entity->GetComponent(); + auto characterComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); // Remove mission items for (auto* task : m_Tasks) { diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 344427c6..6bd29bb0 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -194,7 +194,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& return; } - auto* inventoryComponent = mission->GetAssociate()->GetComponent(); + auto inventoryComponent = mission->GetAssociate()->GetComponent(); if (inventoryComponent != nullptr) { int32_t itemCount = inventoryComponent->GetLotCountNonTransfer(value); @@ -213,7 +213,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& } Entity* entity; - ScriptedActivityComponent* activity; + std::shared_ptr activity; uint32_t activityId; uint32_t lot; uint32_t collectionId; @@ -238,7 +238,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - activity = static_cast(entity->GetComponent(eReplicaComponentType::QUICK_BUILD)); + activity = entity->GetComponent(); if (activity == nullptr) { break; } @@ -308,7 +308,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& int32_t gameID = minigameManager->GetLOT(); - auto* sac = minigameManager->GetComponent(); + auto sac = minigameManager->GetComponent(); if (sac != nullptr) { gameID = sac->GetActivityID(); } @@ -368,7 +368,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& if (entity == nullptr) break; - auto* missionComponent = entity->GetComponent(); + auto missionComponent = entity->GetComponent(); if (missionComponent == nullptr) break; diff --git a/dGame/dPropertyBehaviors/ControlBehaviors.cpp b/dGame/dPropertyBehaviors/ControlBehaviors.cpp index c4d4a2aa..5e7b5c00 100644 --- a/dGame/dPropertyBehaviors/ControlBehaviors.cpp +++ b/dGame/dPropertyBehaviors/ControlBehaviors.cpp @@ -30,7 +30,7 @@ #include "UpdateActionMessage.h" #include "UpdateStripUiMessage.h" -void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) { +void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, std::shared_ptr modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) { // auto behavior = modelComponent->FindBehavior(behaviorID); // if (behavior->GetBehaviorID() == -1 || behavior->GetShouldSetNewID()) { // ObjectIDManager::Instance()->RequestPersistentID( @@ -57,7 +57,7 @@ void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* mode } void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner) { - auto* modelComponent = modelEntity->GetComponent(); + auto modelComponent = modelEntity->GetComponent(); if (!modelComponent) return; @@ -79,7 +79,7 @@ void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const Syste GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorList", behaviorsToSerialize); } -void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent) { +void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr ModelComponent) { auto* modelTypeAmf = arguments->Get("ModelType"); if (!modelTypeAmf) return; @@ -137,7 +137,7 @@ void ControlBehaviors::Rename(Entity* modelEntity, const SystemAddress& sysAddr, } // TODO This is also supposed to serialize the state of the behaviors in progress but those aren't implemented yet -void ControlBehaviors::SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) { +void ControlBehaviors::SendBehaviorBlocksToClient(std::shared_ptr modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) { // uint32_t behaviorID = ControlBehaviors::GetBehaviorIDFromArgument(arguments); // auto modelBehavior = modelComponent->FindBehavior(behaviorID); @@ -266,7 +266,7 @@ void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) { } } -void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) { +void ControlBehaviors::MoveToInventory(std::shared_ptr modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) { // This closes the UI menu should it be open while the player is removing behaviors AMFArrayValue args; @@ -281,7 +281,7 @@ void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const Sys void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress& sysAddr, AMFArrayValue* arguments, std::string command, Entity* modelOwner) { if (!isInitialized || !modelEntity || !modelOwner || !arguments) return; - auto* modelComponent = modelEntity->GetComponent(); + auto modelComponent = modelEntity->GetComponent(); if (!modelComponent) return; diff --git a/dGame/dPropertyBehaviors/ControlBehaviors.h b/dGame/dPropertyBehaviors/ControlBehaviors.h index a562aafe..f0066258 100644 --- a/dGame/dPropertyBehaviors/ControlBehaviors.h +++ b/dGame/dPropertyBehaviors/ControlBehaviors.h @@ -41,9 +41,9 @@ public: */ BlockDefinition* GetBlockInfo(const BlockName& blockName); private: - void RequestUpdatedID(int32_t behaviorID, ModelComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr); + void RequestUpdatedID(int32_t behaviorID, std::shared_ptr modelComponent, Entity* modelOwner, const SystemAddress& sysAddr); void SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner); - void ModelTypeChanged(AMFArrayValue* arguments, ModelComponent* ModelComponent); + void ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr ModelComponent); void ToggleExecutionUpdates(); void AddStrip(AMFArrayValue* arguments); void RemoveStrip(AMFArrayValue* arguments); @@ -56,9 +56,9 @@ private: void Add(AMFArrayValue* arguments); void RemoveActions(AMFArrayValue* arguments); void Rename(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments); - void SendBehaviorBlocksToClient(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments); + void SendBehaviorBlocksToClient(std::shared_ptr modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments); void UpdateAction(AMFArrayValue* arguments); - void MoveToInventory(ModelComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments); + void MoveToInventory(std::shared_ptr modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments); std::map blockTypes{}; // If false, property behaviors will not be able to be edited. diff --git a/dGame/dUtilities/Loot.cpp b/dGame/dUtilities/Loot.cpp index c788c016..217a614c 100644 --- a/dGame/dUtilities/Loot.cpp +++ b/dGame/dUtilities/Loot.cpp @@ -137,7 +137,7 @@ LootGenerator::LootGenerator() { } std::unordered_map LootGenerator::RollLootMatrix(Entity* player, uint32_t matrixIndex) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); std::unordered_map drops; @@ -283,7 +283,7 @@ void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceTy void LootGenerator::GiveLoot(Entity* player, std::unordered_map& result, eLootSourceType lootSourceType) { player = player->GetOwner(); // if the owner is overwritten, we collect that here - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (!inventoryComponent) return; @@ -330,7 +330,7 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) { player = player->GetOwner(); // if the owner is overwritten, we collect that here - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (!inventoryComponent) return; @@ -343,7 +343,7 @@ void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matr void LootGenerator::DropLoot(Entity* player, Entity* killedObject, std::unordered_map& result, uint32_t minCoins, uint32_t maxCoins) { player = player->GetOwner(); // if the owner is overwritten, we collect that here - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (!inventoryComponent) return; diff --git a/dGame/dUtilities/Mail.cpp b/dGame/dUtilities/Mail.cpp index 5dc55765..e538a47a 100644 --- a/dGame/dUtilities/Mail.cpp +++ b/dGame/dUtilities/Mail.cpp @@ -197,7 +197,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd //Inventory::InventoryType itemType; int mailCost = dZoneManager::Instance()->GetWorldConfig()->mailBaseFee; int stackSize = 0; - auto inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = entity->GetComponent(); Item* item = nullptr; if (itemID > 0 && attachmentCount > 0 && inv) { @@ -267,7 +267,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd Game::logger->Log("Mail", "Trying to remove item with ID/count/LOT: %i %i %i", itemID, attachmentCount, itemLOT); inv->RemoveItem(itemLOT, attachmentCount, INVALID, true); - auto* missionCompoent = entity->GetComponent(); + auto missionCompoent = entity->GetComponent(); if (missionCompoent != nullptr) { missionCompoent->Progress(eMissionTaskType::GATHER, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount); @@ -356,7 +356,7 @@ void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddres attachmentCount = res->getInt(2); } - auto inv = static_cast(player->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = player->GetComponent(); if (!inv) return; inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::MAIL); diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index 8602586c..48a95ee2 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -115,10 +115,10 @@ bool Precondition::Check(Entity* player, bool evaluateCosts) const { bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluateCosts) const { - auto* missionComponent = player->GetComponent(); - auto* inventoryComponent = player->GetComponent(); - auto* destroyableComponent = player->GetComponent(); - auto* levelComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); + auto levelComponent = player->GetComponent(); auto* character = player->GetCharacter(); Mission* mission; diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index b65bf723..97aec5e5 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -176,7 +176,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (chatCommand == "pvp") { - auto* character = entity->GetComponent(); + auto character = entity->GetComponent(); if (character == nullptr) { Game::logger->Log("SlashCommandHandler", "Failed to find character component!"); @@ -227,9 +227,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (chatCommand == "fix-stats") { // Reset skill component and buff component - auto* skillComponent = entity->GetComponent(); - auto* buffComponent = entity->GetComponent(); - auto* destroyableComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); + auto buffComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); // If any of the components are nullptr, return if (skillComponent == nullptr || buffComponent == nullptr || destroyableComponent == nullptr) { @@ -336,7 +336,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "resurrect") { - ScriptedActivityComponent* scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); + auto scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); if (scriptedActivityComponent) { // check if user is in activity world and if so, they can't resurrect ChatPackets::SendSystemMessage(sysAddr, u"You cannot resurrect in an activity world."); @@ -373,7 +373,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } EntityManager::Instance()->DestructEntity(entity, sysAddr); - auto* charComp = entity->GetComponent(); + auto charComp = entity->GetComponent(); std::string lowerName = args[0]; if (lowerName.empty()) return; std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), ::tolower); @@ -413,7 +413,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size()); RenderComponent::PlayAnimation(entity, anim); - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); if (possessorComponent) { auto* possessedComponent = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); if (possessedComponent) RenderComponent::PlayAnimation(possessedComponent, anim); @@ -468,7 +468,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - auto* controllablePhysicsComponent = entity->GetComponent(); + auto controllablePhysicsComponent = entity->GetComponent(); if (!controllablePhysicsComponent) return; controllablePhysicsComponent->SetSpeedMultiplier(boost); @@ -480,7 +480,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (possessedID != LWOOBJID_EMPTY) { auto possessable = EntityManager::Instance()->GetEntity(possessedID); if (possessable) { - auto* possessControllablePhysicsComponent = possessable->GetComponent(); + auto possessControllablePhysicsComponent = possessable->GetComponent(); if (possessControllablePhysicsComponent) { possessControllablePhysicsComponent->SetSpeedMultiplier(boost); } @@ -579,7 +579,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit GeneralUtils::to_u16string(size)); } else ChatPackets::SendSystemMessage(sysAddr, u"Setting inventory ITEMS to size " + GeneralUtils::to_u16string(size)); - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent) { auto* inventory = inventoryComponent->GetInventory(selectedInventory); @@ -629,7 +629,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - auto comp = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto comp = entity->GetComponent(); if (comp) comp->AcceptMission(missionID, true); return; } @@ -644,7 +644,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - auto comp = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto comp = entity->GetComponent(); if (comp) comp->CompleteMission(missionID, true); return; } @@ -694,7 +694,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - auto* comp = static_cast(entity->GetComponent(eReplicaComponentType::MISSION)); + auto comp = entity->GetComponent(); if (comp == nullptr) { return; @@ -771,7 +771,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "getnavmeshheight" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto control = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); + auto control = entity->GetComponent(); if (!control) return; float y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(control->GetPosition()); @@ -788,7 +788,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - InventoryComponent* inventory = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inventory = entity->GetComponent(); inventory->AddItem(itemLOT, 1, eLootSourceType::MODERATION); } else if (args.size() == 2) { @@ -806,7 +806,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - InventoryComponent* inventory = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); + auto inventory = entity->GetComponent(); inventory->AddItem(itemLOT, count, eLootSourceType::MODERATION); } else { @@ -935,12 +935,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); if (possessorComponent) { auto* possassableEntity = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); if (possassableEntity != nullptr) { - auto* vehiclePhysicsComponent = possassableEntity->GetComponent(); + auto vehiclePhysicsComponent = possassableEntity->GetComponent(); if (vehiclePhysicsComponent) { vehiclePhysicsComponent->SetPosition(pos); EntityManager::Instance()->SerializeEntity(possassableEntity); @@ -962,7 +962,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "dismount" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); if (possessorComponent) { auto possessableId = possessorComponent->GetPossessable(); if (possessableId != LWOOBJID_EMPTY) { @@ -1171,7 +1171,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit //------------------------------------------------- if (chatCommand == "buffme" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto dest = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto dest = entity->GetComponent(); if (dest) { dest->SetHealth(999); dest->SetMaxHealth(999.0f); @@ -1195,7 +1195,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "buffmed" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto dest = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto dest = entity->GetComponent(); if (dest) { dest->SetHealth(9); dest->SetMaxHealth(9.0f); @@ -1209,7 +1209,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (chatCommand == "refillstats" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto dest = static_cast(entity->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto dest = entity->GetComponent(); if (dest) { dest->SetHealth((int)dest->GetMaxHealth()); dest->SetArmor((int)dest->GetMaxArmor()); @@ -1242,7 +1242,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "spawn" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) { - ControllablePhysicsComponent* comp = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); + auto comp = entity->GetComponent(); if (!comp) return; uint32_t lot; @@ -1341,7 +1341,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - CharacterComponent* character = entity->GetComponent(); + auto character = entity->GetComponent(); if (character) character->SetUScore(character->GetUScore() + uscore); // MODERATION should work but it doesn't. Relog to see uscore changes @@ -1486,7 +1486,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "gmimmune" && args.size() >= 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto* destroyableComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); int32_t state = false; @@ -1503,7 +1503,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "buff" && args.size() >= 2 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto* buffComponent = entity->GetComponent(); + auto buffComponent = entity->GetComponent(); int32_t id = 0; int32_t duration = 0; @@ -1615,7 +1615,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if ((chatCommand == "boost") && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); if (possessorComponent == nullptr) { return; @@ -1647,7 +1647,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if ((chatCommand == "unboost") && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - auto* possessorComponent = entity->GetComponent(); + auto possessorComponent = entity->GetComponent(); if (possessorComponent == nullptr) return; auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); @@ -1674,7 +1674,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit //Go tell physics to spawn all the vertices: auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PHANTOM_PHYSICS); for (auto en : entities) { - auto phys = static_cast(en->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS)); + auto phys = en->GetComponent(); if (phys) phys->SpawnVertices(); } @@ -1683,7 +1683,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (chatCommand == "reportproxphys" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) { auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROXIMITY_MONITOR); for (auto en : entities) { - auto phys = static_cast(en->GetComponent(eReplicaComponentType::PROXIMITY_MONITOR)); + auto phys = en->GetComponent(); if (phys) { for (auto prox : phys->GetProximitiesData()) { if (!prox.second) continue; @@ -1717,7 +1717,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (!GeneralUtils::TryParse(args[0], baseItem)) return; if (!GeneralUtils::TryParse(args[1], reforgedItem)) return; - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent == nullptr) return; @@ -1779,7 +1779,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit dpWorld::Instance().Reload(); auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); for (auto entity : entities) { - auto* scriptedActivityComponent = entity->GetComponent(); + auto scriptedActivityComponent = entity->GetComponent(); if (!scriptedActivityComponent) continue; scriptedActivityComponent->ReloadConfig(); @@ -1842,7 +1842,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (!inventoryComponent) return; auto* inventoryToDelete = inventoryComponent->GetInventory(inventoryType); @@ -1930,7 +1930,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (args.size() >= 2) { if (args[1] == "-m" && args.size() >= 3) { - auto* movingPlatformComponent = closest->GetComponent(); + auto movingPlatformComponent = closest->GetComponent(); int32_t value = 0; @@ -1964,7 +1964,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit GeneralUtils::ASCIIToUTF16("< " + std::to_string(postion.x) + ", " + std::to_string(postion.y) + ", " + std::to_string(postion.z) + " >") ); } else if (args[1] == "-f") { - auto* destuctable = closest->GetComponent(); + auto destuctable = closest->GetComponent(); if (destuctable == nullptr) { ChatPackets::SendSystemMessage(sysAddr, u"No destroyable component on this entity!"); @@ -1993,7 +1993,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit destuctable->AddFaction(faction, true); } } else if (args[1] == "-t") { - auto* phantomPhysicsComponent = closest->GetComponent(); + auto phantomPhysicsComponent = closest->GetComponent(); if (phantomPhysicsComponent != nullptr) { ChatPackets::SendSystemMessage(sysAddr, u"Type: " + (GeneralUtils::to_u16string(static_cast(phantomPhysicsComponent->GetEffectType())))); @@ -2003,7 +2003,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit ChatPackets::SendSystemMessage(sysAddr, u"Active: " + (GeneralUtils::to_u16string(phantomPhysicsComponent->GetPhysicsEffectActive()))); } - auto* triggerComponent = closest->GetComponent(); + auto triggerComponent = closest->GetComponent(); if (triggerComponent) { auto trigger = triggerComponent->GetTrigger(); if (trigger) { diff --git a/dGame/dUtilities/VanityUtilities.cpp b/dGame/dUtilities/VanityUtilities.cpp index 7fabfbce..0bb8dfa8 100644 --- a/dGame/dUtilities/VanityUtilities.cpp +++ b/dGame/dUtilities/VanityUtilities.cpp @@ -117,7 +117,7 @@ void VanityUtilities::SpawnVanity() { npcEntity->SetVar>(u"chats", npc.m_Phrases); - auto* scriptComponent = npcEntity->GetComponent(); + auto scriptComponent = npcEntity->GetComponent(); if (scriptComponent != nullptr) { scriptComponent->SetScript(npc.m_Script); @@ -161,13 +161,13 @@ Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoin auto* entity = EntityManager::Instance()->CreateEntity(info); entity->SetVar(u"npcName", name); - auto* inventoryComponent = entity->GetComponent(); + auto inventoryComponent = entity->GetComponent(); if (inventoryComponent != nullptr) { inventoryComponent->SetNPCItems(inventory); } - auto* destroyableComponent = entity->GetComponent(); + auto destroyableComponent = entity->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetIsGMImmune(true); @@ -519,7 +519,7 @@ void VanityUtilities::SetupNPCTalk(Entity* npc) { } void VanityUtilities::NPCTalk(Entity* npc) { - auto* proximityMonitorComponent = npc->GetComponent(); + auto proximityMonitorComponent = npc->GetComponent(); if (!proximityMonitorComponent->GetProximityObjects("talk").empty()) { const auto& chats = npc->GetVar>(u"chats"); diff --git a/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp b/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp index a51af03a..33caa474 100644 --- a/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp +++ b/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp @@ -29,9 +29,9 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) { //self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true } //Get our components: - destroyable = static_cast(self->GetComponent(eReplicaComponentType::DESTROYABLE)); - controllable = static_cast(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); - combat = static_cast(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI)); + auto destroyable = self->GetComponent(); + auto controllable = self->GetComponent(); + auto combat = self->GetComponent(); if (!destroyable || !controllable) return; @@ -53,7 +53,7 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) { void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) { if (dZoneManager::Instance()->GetZoneID().GetMapID() == instanceZoneID) { - auto* missionComponent = killer->GetComponent(); + auto missionComponent = killer->GetComponent(); if (missionComponent == nullptr) return; @@ -99,7 +99,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra EntityManager::Instance()->SerializeEntity(self); - auto* baseCombatAi = self->GetComponent(); + auto baseCombatAi = self->GetComponent(); baseCombatAi->SetDisabled(true); @@ -123,7 +123,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra //Cancel all remaining timers for say idle anims: self->CancelAllTimers(); - auto* baseCombatAi = self->GetComponent(); + auto baseCombatAi = self->GetComponent(); baseCombatAi->SetDisabled(false); @@ -314,7 +314,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) { return; } - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent == nullptr) { Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!"); @@ -347,7 +347,7 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) { const auto target = attackTargetTable[0]; - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); skillComponent->CalculateBehavior(1394, 32612, target, true); @@ -381,7 +381,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) { attackTargetTable.push_back(attackFocus); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); skillComponent->CalculateBehavior(1480, 36652, attackFocus, true); @@ -493,14 +493,14 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim auto landingTarget = self->GetI64(u"LandingTarget"); auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY); } if (landingEntity) { - auto* landingSkill = landingEntity->GetComponent(); + auto landingSkill = landingEntity->GetComponent(); if (landingSkill != nullptr) { landingSkill->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY, true); diff --git a/dScripts/02_server/Enemy/AM/AmDarklingDragon.cpp b/dScripts/02_server/Enemy/AM/AmDarklingDragon.cpp index ff30f8e8..19dfc4f1 100644 --- a/dScripts/02_server/Enemy/AM/AmDarklingDragon.cpp +++ b/dScripts/02_server/Enemy/AM/AmDarklingDragon.cpp @@ -12,7 +12,7 @@ void AmDarklingDragon::OnStartup(Entity* self) { self->SetVar(u"weakspot", 0); - auto* baseCombatAIComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetStunImmune(true); @@ -46,7 +46,7 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t } } - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { if (destroyableComponent->GetArmor() > 0) return; @@ -56,8 +56,8 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t if (weakpoint == 0) { self->AddTimer("ReviveTimer", 12); - auto* baseCombatAIComponent = self->GetComponent(); - auto* skillComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetDisabled(true); @@ -127,8 +127,8 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) { RenderComponent::PlayAnimation(self, u"stunend", 2.0f); self->AddTimer("backToAttack", 1); } else if (timerName == "backToAttack") { - auto* baseCombatAIComponent = self->GetComponent(); - auto* skillComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetDisabled(false); baseCombatAIComponent->SetStunned(false); diff --git a/dScripts/02_server/Enemy/AM/AmSkeletonEngineer.cpp b/dScripts/02_server/Enemy/AM/AmSkeletonEngineer.cpp index a4972729..af1fc481 100644 --- a/dScripts/02_server/Enemy/AM/AmSkeletonEngineer.cpp +++ b/dScripts/02_server/Enemy/AM/AmSkeletonEngineer.cpp @@ -3,8 +3,8 @@ #include "SkillComponent.h" void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker) { - auto* destroyableComponent = self->GetComponent(); - auto* skillComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (destroyableComponent == nullptr || skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Enemy/FV/FvMaelstromDragon.cpp b/dScripts/02_server/Enemy/FV/FvMaelstromDragon.cpp index 664d8b67..5be38ace 100644 --- a/dScripts/02_server/Enemy/FV/FvMaelstromDragon.cpp +++ b/dScripts/02_server/Enemy/FV/FvMaelstromDragon.cpp @@ -10,7 +10,7 @@ void FvMaelstromDragon::OnStartup(Entity* self) { self->SetVar(u"weakspot", 0); - auto* baseCombatAIComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetStunImmune(true); @@ -59,7 +59,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_ } } - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { if (destroyableComponent->GetArmor() > 0) return; @@ -71,8 +71,8 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_ self->AddTimer("ReviveTimer", 12); - auto* baseCombatAIComponent = self->GetComponent(); - auto* skillComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetDisabled(true); @@ -143,8 +143,8 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) { RenderComponent::PlayAnimation(self, u"stunend", 2.0f); self->AddTimer("backToAttack", 1.0f); } else if (timerName == "backToAttack") { - auto* baseCombatAIComponent = self->GetComponent(); - auto* skillComponent = self->GetComponent(); + auto baseCombatAIComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (baseCombatAIComponent != nullptr) { baseCombatAIComponent->SetDisabled(false); diff --git a/dScripts/02_server/Enemy/General/BaseEnemyApe.cpp b/dScripts/02_server/Enemy/General/BaseEnemyApe.cpp index 19a6490a..029cf633 100644 --- a/dScripts/02_server/Enemy/General/BaseEnemyApe.cpp +++ b/dScripts/02_server/Enemy/General/BaseEnemyApe.cpp @@ -31,11 +31,11 @@ void BaseEnemyApe::OnSkillCast(Entity* self, uint32_t skillID) { } void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) { - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) { StunApe(self, true); self->CancelTimer("spawnQBTime"); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent) { skillComponent->Reset(); } @@ -52,7 +52,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) { // Revives the ape, giving it back some armor const auto timesStunned = self->GetVar(u"timesStunned"); - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned); } @@ -104,7 +104,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) { return; } - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(1273, 29446, self->GetObjectID(), true, false, player->GetObjectID()); } @@ -123,12 +123,12 @@ void BaseEnemyApe::OnFireEventServerSide(Entity* self, Entity* sender, std::stri } void BaseEnemyApe::StunApe(Entity* self, bool stunState) { - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(stunState); combatAIComponent->SetStunned(stunState); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->Interrupt(); } diff --git a/dScripts/02_server/Enemy/General/BaseEnemyMech.cpp b/dScripts/02_server/Enemy/General/BaseEnemyMech.cpp index ce42585c..5ab92a46 100644 --- a/dScripts/02_server/Enemy/General/BaseEnemyMech.cpp +++ b/dScripts/02_server/Enemy/General/BaseEnemyMech.cpp @@ -9,14 +9,14 @@ #include "eReplicaComponentType.h" void BaseEnemyMech::OnStartup(Entity* self) { - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetFaction(4); } } void BaseEnemyMech::OnDie(Entity* self, Entity* killer) { - ControllablePhysicsComponent* controlPhys = static_cast(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); + auto controlPhys = self->GetComponent(); if (!controlPhys) return; NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z }; diff --git a/dScripts/02_server/Enemy/General/EnemyNjBuff.cpp b/dScripts/02_server/Enemy/General/EnemyNjBuff.cpp index 07b2d899..949f3eaf 100644 --- a/dScripts/02_server/Enemy/General/EnemyNjBuff.cpp +++ b/dScripts/02_server/Enemy/General/EnemyNjBuff.cpp @@ -2,7 +2,7 @@ #include "SkillComponent.h" void EnemyNjBuff::OnStartup(Entity* self) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Enemy/General/TreasureChestDragonServer.cpp b/dScripts/02_server/Enemy/General/TreasureChestDragonServer.cpp index 19788677..de42cfc9 100644 --- a/dScripts/02_server/Enemy/General/TreasureChestDragonServer.cpp +++ b/dScripts/02_server/Enemy/General/TreasureChestDragonServer.cpp @@ -15,7 +15,7 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) { self->SetVar(u"bUsed", true); - auto* scriptedActivityComponent = self->GetComponent(); + auto scriptedActivityComponent = self->GetComponent(); if (scriptedActivityComponent == nullptr) { return; diff --git a/dScripts/02_server/Enemy/Survival/AgSurvivalMech.cpp b/dScripts/02_server/Enemy/Survival/AgSurvivalMech.cpp index 99f40b8b..d1df92f4 100644 --- a/dScripts/02_server/Enemy/Survival/AgSurvivalMech.cpp +++ b/dScripts/02_server/Enemy/Survival/AgSurvivalMech.cpp @@ -4,7 +4,7 @@ void AgSurvivalMech::OnStartup(Entity* self) { BaseWavesGenericEnemy::OnStartup(self); - auto* destroyable = self->GetComponent(); + auto destroyable = self->GetComponent(); if (destroyable != nullptr) { destroyable->SetFaction(4); } diff --git a/dScripts/02_server/Enemy/Survival/AgSurvivalSpiderling.cpp b/dScripts/02_server/Enemy/Survival/AgSurvivalSpiderling.cpp index 8e2c173c..82bee2b5 100644 --- a/dScripts/02_server/Enemy/Survival/AgSurvivalSpiderling.cpp +++ b/dScripts/02_server/Enemy/Survival/AgSurvivalSpiderling.cpp @@ -4,7 +4,7 @@ void AgSurvivalSpiderling::OnStartup(Entity* self) { BaseWavesGenericEnemy::OnStartup(self); - auto* combatAI = self->GetComponent(); + auto combatAI = self->GetComponent(); if (combatAI != nullptr) { combatAI->SetStunImmune(true); } diff --git a/dScripts/02_server/Enemy/Waves/WaveBossApe.cpp b/dScripts/02_server/Enemy/Waves/WaveBossApe.cpp index 7c26cec1..359b37ee 100644 --- a/dScripts/02_server/Enemy/Waves/WaveBossApe.cpp +++ b/dScripts/02_server/Enemy/Waves/WaveBossApe.cpp @@ -11,7 +11,7 @@ void WaveBossApe::OnStartup(Entity* self) { self->SetVar(u"AnchorDamageDelayTime", 0.5f); self->SetVar(u"spawnQBTime", 5.0f); - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(true); combatAIComponent->SetStunImmune(true); @@ -30,7 +30,7 @@ void WaveBossApe::OnDie(Entity* self, Entity* killer) { void WaveBossApe::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "startAI") { - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(false); combatAIComponent->SetStunImmune(false); diff --git a/dScripts/02_server/Enemy/Waves/WaveBossHammerling.cpp b/dScripts/02_server/Enemy/Waves/WaveBossHammerling.cpp index 4fa78087..fcbe1d4c 100644 --- a/dScripts/02_server/Enemy/Waves/WaveBossHammerling.cpp +++ b/dScripts/02_server/Enemy/Waves/WaveBossHammerling.cpp @@ -5,7 +5,7 @@ void WaveBossHammerling::OnStartup(Entity* self) { BaseWavesGenericEnemy::OnStartup(self); - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(true); combatAIComponent->SetStunImmune(true); @@ -17,7 +17,7 @@ void WaveBossHammerling::OnStartup(Entity* self) { void WaveBossHammerling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "startAI") { - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(false); } diff --git a/dScripts/02_server/Enemy/Waves/WaveBossHorsemen.cpp b/dScripts/02_server/Enemy/Waves/WaveBossHorsemen.cpp index 238544ab..fb685ef8 100644 --- a/dScripts/02_server/Enemy/Waves/WaveBossHorsemen.cpp +++ b/dScripts/02_server/Enemy/Waves/WaveBossHorsemen.cpp @@ -5,7 +5,7 @@ void WaveBossHorsemen::OnStartup(Entity* self) { BaseWavesGenericEnemy::OnStartup(self); - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(true); combatAIComponent->SetStunImmune(true); @@ -18,7 +18,7 @@ void WaveBossHorsemen::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "startAI") { - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(false); } diff --git a/dScripts/02_server/Enemy/Waves/WaveBossSpiderling.cpp b/dScripts/02_server/Enemy/Waves/WaveBossSpiderling.cpp index ec282ff4..908d29b7 100644 --- a/dScripts/02_server/Enemy/Waves/WaveBossSpiderling.cpp +++ b/dScripts/02_server/Enemy/Waves/WaveBossSpiderling.cpp @@ -5,7 +5,7 @@ void WaveBossSpiderling::OnStartup(Entity* self) { BaseWavesGenericEnemy::OnStartup(self); - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(true); combatAIComponent->SetStunImmune(true); @@ -17,7 +17,7 @@ void WaveBossSpiderling::OnStartup(Entity* self) { void WaveBossSpiderling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "startAI") { - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(false); combatAIComponent->SetStunImmune(false); diff --git a/dScripts/02_server/Equipment/BootyDigServer.cpp b/dScripts/02_server/Equipment/BootyDigServer.cpp index 190c232b..d1355781 100644 --- a/dScripts/02_server/Equipment/BootyDigServer.cpp +++ b/dScripts/02_server/Equipment/BootyDigServer.cpp @@ -35,13 +35,13 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string // Make sure players only dig up one booty per instance player->SetVar(u"bootyDug", true); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { auto* mission = missionComponent->GetMission(1881); if (mission != nullptr && (mission->GetMissionState() == eMissionState::ACTIVE || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) { mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) renderComponent->PlayEffect(7730, u"cast", "bootyshine"); diff --git a/dScripts/02_server/Map/AG/AgBugsprayer.cpp b/dScripts/02_server/Map/AG/AgBugsprayer.cpp index d4ab7aa3..c3da2638 100644 --- a/dScripts/02_server/Map/AG/AgBugsprayer.cpp +++ b/dScripts/02_server/Map/AG/AgBugsprayer.cpp @@ -8,7 +8,7 @@ void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) { void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "castSkill") { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) return; diff --git a/dScripts/02_server/Map/AG/AgCagedBricksServer.cpp b/dScripts/02_server/Map/AG/AgCagedBricksServer.cpp index 13c9c04b..b732a7f4 100644 --- a/dScripts/02_server/Map/AG/AgCagedBricksServer.cpp +++ b/dScripts/02_server/Map/AG/AgCagedBricksServer.cpp @@ -21,7 +21,7 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) { character->SetPlayerFlag(ePlayerFlag::CAGED_SPIDER, true); //Remove the maelstrom cube: - auto inv = static_cast(user->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = user->GetComponent(); if (inv) { inv->RemoveItem(14553, 1); diff --git a/dScripts/02_server/Map/AG/AgLaserSensorServer.cpp b/dScripts/02_server/Map/AG/AgLaserSensorServer.cpp index 7fcea9fa..effc523b 100644 --- a/dScripts/02_server/Map/AG/AgLaserSensorServer.cpp +++ b/dScripts/02_server/Map/AG/AgLaserSensorServer.cpp @@ -8,7 +8,7 @@ void AgLaserSensorServer::OnStartup(Entity* self) { self->SetBoolean(u"active", true); auto repelForce = self->GetVarAs(u"repelForce"); if (!repelForce) repelForce = m_RepelForce; - auto* phantomPhysicsComponent = self->GetComponent(); + auto phantomPhysicsComponent = self->GetComponent(); if (!phantomPhysicsComponent) return; phantomPhysicsComponent->SetPhysicsEffectActive(true); phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE); @@ -22,7 +22,7 @@ void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) { if (!active) return; auto skillCastID = self->GetVarAs(u"skillCastID"); if (skillCastID == 0) skillCastID = m_SkillCastID; - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (!skillComponent) return; skillComponent->CastSkill(m_SkillCastID, target->GetObjectID()); } diff --git a/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp b/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp index d2cc647e..7f8f97ec 100644 --- a/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp +++ b/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp @@ -13,7 +13,7 @@ void NpcAgCourseStarter::OnStartup(Entity* self) { } void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) { - auto* scriptedActivityComponent = self->GetComponent(); + auto scriptedActivityComponent = self->GetComponent(); if (scriptedActivityComponent == nullptr) { return; @@ -27,7 +27,7 @@ void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) { } void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) { - auto* scriptedActivityComponent = self->GetComponent(); + auto scriptedActivityComponent = self->GetComponent(); if (scriptedActivityComponent == nullptr) { return; @@ -70,7 +70,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3 void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { - auto* scriptedActivityComponent = self->GetComponent(); + auto scriptedActivityComponent = self->GetComponent(); if (scriptedActivityComponent == nullptr) return; @@ -88,7 +88,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std data->values[2] = *(float*)&finish; - auto* missionComponent = sender->GetComponent(); + auto missionComponent = sender->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgressTaskType(1884, 1, 1, false); missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, -finish, self->GetObjectID(), diff --git a/dScripts/02_server/Map/AG/NpcCowboyServer.cpp b/dScripts/02_server/Map/AG/NpcCowboyServer.cpp index 6dd212a4..ee42ffd3 100644 --- a/dScripts/02_server/Map/AG/NpcCowboyServer.cpp +++ b/dScripts/02_server/Map/AG/NpcCowboyServer.cpp @@ -7,7 +7,7 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss return; } - auto* inventoryComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); if (inventoryComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp b/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp index 8ee2e988..a606c581 100644 --- a/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp +++ b/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp @@ -12,7 +12,7 @@ void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) { GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress()); - auto* inv = static_cast(target->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = target->GetComponent(); // If we are ready to complete our missions, we take the kit from you: if (inv && missionState == eMissionState::READY_TO_COMPLETE) { @@ -23,7 +23,7 @@ void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int } } } else if (missionState == eMissionState::AVAILABLE) { - auto* missionComponent = static_cast(target->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = target->GetComponent(); missionComponent->CompleteMission(mailAchievement, true); } } diff --git a/dScripts/02_server/Map/AG/NpcPirateServer.cpp b/dScripts/02_server/Map/AG/NpcPirateServer.cpp index cad0d64c..2bda80a2 100644 --- a/dScripts/02_server/Map/AG/NpcPirateServer.cpp +++ b/dScripts/02_server/Map/AG/NpcPirateServer.cpp @@ -3,7 +3,7 @@ #include "InventoryComponent.h" void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { - auto* inventory = target->GetComponent(); + auto inventory = target->GetComponent(); if (inventory != nullptr && missionID == 1881) { auto* luckyShovel = inventory->FindItemByLot(14591); diff --git a/dScripts/02_server/Map/AG/NpcWispServer.cpp b/dScripts/02_server/Map/AG/NpcWispServer.cpp index 84196c8c..2ab6f7a0 100644 --- a/dScripts/02_server/Map/AG/NpcWispServer.cpp +++ b/dScripts/02_server/Map/AG/NpcWispServer.cpp @@ -9,7 +9,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio if (missionID != 1849 && missionID != 1883) return; - auto* inventory = target->GetComponent(); + auto inventory = target->GetComponent(); if (inventory == nullptr) return; diff --git a/dScripts/02_server/Map/AG/RemoveRentalGear.cpp b/dScripts/02_server/Map/AG/RemoveRentalGear.cpp index f9bdf1ce..1ee305ec 100644 --- a/dScripts/02_server/Map/AG/RemoveRentalGear.cpp +++ b/dScripts/02_server/Map/AG/RemoveRentalGear.cpp @@ -23,7 +23,7 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis if (missionID != defaultMission && missionID != 313) return; if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) { - auto inv = static_cast(target->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = target->GetComponent(); if (!inv) return; //remove the inventory items diff --git a/dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp b/dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp index 2711b179..29e068a7 100644 --- a/dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp +++ b/dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp @@ -28,7 +28,7 @@ void ZoneAgSpiderQueen::BasePlayerLoaded(Entity* self, Entity* player) { ActivityManager::TakeActivityCost(self, player->GetObjectID()); // Make sure the player has full stats when they join - auto* playerDestroyableComponent = player->GetComponent(); + auto playerDestroyableComponent = player->GetComponent(); if (playerDestroyableComponent != nullptr) { playerDestroyableComponent->SetImagination(playerDestroyableComponent->GetMaxImagination()); playerDestroyableComponent->SetArmor(playerDestroyableComponent->GetMaxArmor()); diff --git a/dScripts/02_server/Map/AM/AmBlueX.cpp b/dScripts/02_server/Map/AM/AmBlueX.cpp index 8e32694c..4e9426ee 100644 --- a/dScripts/02_server/Map/AM/AmBlueX.cpp +++ b/dScripts/02_server/Map/AM/AmBlueX.cpp @@ -5,7 +5,7 @@ #include "Character.h" void AmBlueX::OnUse(Entity* self, Entity* user) { - auto* skillComponent = user->GetComponent(); + auto skillComponent = user->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID()); } @@ -37,7 +37,7 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string& self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() { auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID); auto* player = EntityManager::Instance()->GetEntity(playerID); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) return; diff --git a/dScripts/02_server/Map/AM/AmDrawBridge.cpp b/dScripts/02_server/Map/AM/AmDrawBridge.cpp index 3c4dcce6..a1831562 100644 --- a/dScripts/02_server/Map/AM/AmDrawBridge.cpp +++ b/dScripts/02_server/Map/AM/AmDrawBridge.cpp @@ -60,7 +60,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) { self->SetNetworkVar(u"BridgeLeaving", false); - auto* simplePhysicsComponent = bridge->GetComponent(); + auto simplePhysicsComponent = bridge->GetComponent(); if (simplePhysicsComponent == nullptr) { return; @@ -87,7 +87,7 @@ void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::strin } void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) { - auto* simplePhysicsComponent = bridge->GetComponent(); + auto simplePhysicsComponent = bridge->GetComponent(); if (simplePhysicsComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp index f23fa93f..d5c28eac 100644 --- a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp +++ b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp @@ -10,14 +10,14 @@ void AmDropshipComputer::OnStartup(Entity* self) { } void AmDropshipComputer::OnUse(Entity* self, Entity* user) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) { return; } - auto* missionComponent = user->GetComponent(); - auto* inventoryComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); if (missionComponent == nullptr || inventoryComponent == nullptr) { return; @@ -70,7 +70,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) { } void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmScrollReaderServer.cpp b/dScripts/02_server/Map/AM/AmScrollReaderServer.cpp index cb8a7dba..cb7aabd1 100644 --- a/dScripts/02_server/Map/AM/AmScrollReaderServer.cpp +++ b/dScripts/02_server/Map/AM/AmScrollReaderServer.cpp @@ -3,7 +3,7 @@ void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) { if (identifier == u"story_end") { - auto* missionComponent = sender->GetComponent(); + auto missionComponent = sender->GetComponent(); if (missionComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmShieldGenerator.cpp b/dScripts/02_server/Map/AM/AmShieldGenerator.cpp index 5d1b7d08..97715954 100644 --- a/dScripts/02_server/Map/AM/AmShieldGenerator.cpp +++ b/dScripts/02_server/Map/AM/AmShieldGenerator.cpp @@ -15,7 +15,7 @@ void AmShieldGenerator::OnStartup(Entity* self) { } void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { - auto* destroyableComponent = entering->GetComponent(); + auto destroyableComponent = entering->GetComponent(); if (status == "ENTER" && name == "shield") { if (destroyableComponent->HasFaction(4)) { @@ -102,7 +102,7 @@ void AmShieldGenerator::StartShield(Entity* self) { } void AmShieldGenerator::BuffPlayers(Entity* self) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) { return; @@ -122,8 +122,8 @@ void AmShieldGenerator::BuffPlayers(Entity* self) { } void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) { - auto* baseCombatAIComponent = intruder->GetComponent(); - auto* movementAIComponent = intruder->GetComponent(); + auto baseCombatAIComponent = intruder->GetComponent(); + auto movementAIComponent = intruder->GetComponent(); if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp b/dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp index 381c13bc..09c5e18e 100644 --- a/dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp +++ b/dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp @@ -15,7 +15,7 @@ void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) { } void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { - auto* destroyableComponent = entering->GetComponent(); + auto destroyableComponent = entering->GetComponent(); if (name == "shield") { if (!destroyableComponent->HasFaction(4) || entering->IsPlayer()) { @@ -122,7 +122,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target continue; } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) { return; @@ -154,7 +154,7 @@ void AmShieldGeneratorQuickbuild::StartShield(Entity* self) { } void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) { return; @@ -174,14 +174,14 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) { } void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) { return; } - auto* baseCombatAIComponent = intruder->GetComponent(); - auto* movementAIComponent = intruder->GetComponent(); + auto baseCombatAIComponent = intruder->GetComponent(); + auto movementAIComponent = intruder->GetComponent(); if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmSkullkinDrill.cpp b/dScripts/02_server/Map/AM/AmSkullkinDrill.cpp index e35c700d..7ad75862 100644 --- a/dScripts/02_server/Map/AM/AmSkullkinDrill.cpp +++ b/dScripts/02_server/Map/AM/AmSkullkinDrill.cpp @@ -14,7 +14,7 @@ void AmSkullkinDrill::OnStartup(Entity* self) { GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active"); - auto* movingPlatformComponent = self->GetComponent(); + auto movingPlatformComponent = self->GetComponent(); if (movingPlatformComponent == nullptr) { return; @@ -58,7 +58,7 @@ void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std: return; } - auto* proximityMonitorComponent = self->GetComponent(); + auto proximityMonitorComponent = self->GetComponent(); if (proximityMonitorComponent == nullptr || !proximityMonitorComponent->IsInProximity("spin_distance", caster->GetObjectID())) { return; @@ -82,7 +82,7 @@ void AmSkullkinDrill::TriggerDrill(Entity* self) { standObj->SetVar(u"bActive", false); } - auto* movingPlatformComponent = self->GetComponent(); + auto movingPlatformComponent = self->GetComponent(); if (movingPlatformComponent == nullptr) { return; @@ -223,7 +223,7 @@ void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& } void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) { - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent == nullptr || !attacker->IsPlayer()) { return; @@ -239,7 +239,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t // TODO: Missions if (activator != nullptr) { - auto* missionComponent = activator->GetComponent(); + auto missionComponent = activator->GetComponent(); if (missionComponent != nullptr) { for (const auto missionID : m_MissionsToUpdate) { @@ -279,7 +279,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) { standObj->SetVar(u"bActive", true); } - auto* movingPlatformComponent = self->GetComponent(); + auto movingPlatformComponent = self->GetComponent(); if (movingPlatformComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/AM/AmSkullkinTower.cpp b/dScripts/02_server/Map/AM/AmSkullkinTower.cpp index f7825f8f..da76c10b 100644 --- a/dScripts/02_server/Map/AM/AmSkullkinTower.cpp +++ b/dScripts/02_server/Map/AM/AmSkullkinTower.cpp @@ -12,7 +12,7 @@ void AmSkullkinTower::OnStartup(Entity* self) { // onPhysicsComponentReady - auto* movingPlatformComponent = self->GetComponent(); + auto movingPlatformComponent = self->GetComponent(); if (movingPlatformComponent != nullptr) { movingPlatformComponent->StopPathing(); @@ -82,7 +82,7 @@ void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) { child->AddDieCallback([this, selfID, child]() { auto* self = EntityManager::Instance()->GetEntity(selfID); - auto* destroyableComponent = child->GetComponent(); + auto destroyableComponent = child->GetComponent(); if (destroyableComponent == nullptr || self == nullptr) { return; @@ -163,7 +163,7 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) { continue; } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) { continue; diff --git a/dScripts/02_server/Map/AM/AmTeapotServer.cpp b/dScripts/02_server/Map/AM/AmTeapotServer.cpp index 93f05326..68c7fda3 100644 --- a/dScripts/02_server/Map/AM/AmTeapotServer.cpp +++ b/dScripts/02_server/Map/AM/AmTeapotServer.cpp @@ -5,7 +5,7 @@ #include "eTerminateType.h" void AmTeapotServer::OnUse(Entity* self, Entity* user) { - auto* inventoryComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); if (!inventoryComponent) return; auto* blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::ITEMS); diff --git a/dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp b/dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp index 3acc9063..38046407 100644 --- a/dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp +++ b/dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp @@ -6,7 +6,7 @@ void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, cons return; } - auto* missionComponent = caster->GetComponent(); + auto missionComponent = caster->GetComponent(); const auto missionIDsVariable = GeneralUtils::UTF16ToWTF8(self->GetVar(u"missions")); const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_'); diff --git a/dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp b/dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp index cfc58fa0..e33fa417 100644 --- a/dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp +++ b/dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp @@ -10,7 +10,7 @@ void EnemyRoninSpawner::OnStartup(Entity* self) { void EnemyRoninSpawner::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "hatchTime") { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(644, u"create", "BurstFX1"); @@ -42,7 +42,7 @@ void EnemyRoninSpawner::OnProximityUpdate(Entity* self, Entity* entering, std::s if (entering->IsPlayer() && name == "ronin" && status == "ENTER" && !self->GetVar(u"hatching")) { StartHatching(self); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(305, 3568, LWOOBJID_EMPTY); @@ -59,7 +59,7 @@ void EnemyRoninSpawner::OnHit(Entity* self, Entity* attacker) { void EnemyRoninSpawner::StartHatching(Entity* self) { self->SetVar(u"hatching", true); - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(2260, u"rebuild_medium", "WakeUpFX1"); diff --git a/dScripts/02_server/Map/FV/FvCandle.cpp b/dScripts/02_server/Map/FV/FvCandle.cpp index 0c4344d0..30365fce 100644 --- a/dScripts/02_server/Map/FV/FvCandle.cpp +++ b/dScripts/02_server/Map/FV/FvCandle.cpp @@ -6,7 +6,7 @@ std::vector FvCandle::m_Missions = { 850, 1431, 1529, 1566, 1603 }; void FvCandle::OnStartup(Entity* self) { - auto* render = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto render = self->GetComponent(); if (render == nullptr) return; @@ -23,11 +23,11 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) { if (self->GetBoolean(u"AmHit")) return; - auto* render = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto render = self->GetComponent(); if (render == nullptr) return; - auto* missionComponent = blower->GetComponent(); + auto missionComponent = blower->GetComponent(); if (missionComponent != nullptr) { for (const auto mission : m_Missions) { @@ -47,7 +47,7 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) { void FvCandle::OnTimerDone(Entity* self, std::string timerName) { self->SetBoolean(u"AmHit", false); - auto* render = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto render = self->GetComponent(); if (render == nullptr) return; diff --git a/dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp b/dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp index e87d9629..cb86d92b 100644 --- a/dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp +++ b/dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp @@ -39,7 +39,7 @@ FvHorsemenTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::stri continue; } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) { continue; diff --git a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp index 7d86cc73..d23ac6ce 100644 --- a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp +++ b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp @@ -19,7 +19,7 @@ void ImgBrickConsoleQB::OnStartup(Entity* self) { } void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent->GetState() == eRebuildState::COMPLETED) { if (!self->GetNetworkVar(u"used")) { @@ -28,7 +28,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) { auto bothBuilt = false; for (auto* console : consoles) { - auto* consoleRebuildComponent = console->GetComponent(); + auto consoleRebuildComponent = console->GetComponent(); if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) { continue; @@ -69,8 +69,8 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) { auto* player = user; - auto* missionComponent = player->GetComponent(); - auto* inventoryComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); if (missionComponent != nullptr && inventoryComponent != nullptr) { if (missionComponent->GetMissionState(1302) == eMissionState::ACTIVE) { @@ -145,7 +145,7 @@ void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) { const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console"); for (auto* console : consoles) { - auto* consoleRebuildComponent = console->GetComponent(); + auto consoleRebuildComponent = console->GetComponent(); if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) { continue; @@ -166,7 +166,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) { self->SetVar(u"Died", true); - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent->GetState() == eRebuildState::COMPLETED) { auto offFX = 0; @@ -227,7 +227,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) { void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "reset") { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent->GetState() == eRebuildState::OPEN) { self->Smash(self->GetObjectID(), eKillType::SILENT); diff --git a/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp b/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp index 155be92b..6ec3d0b9 100644 --- a/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp +++ b/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp @@ -23,7 +23,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std: return; } - auto* possessableComponent = entering->GetComponent(); + auto possessableComponent = entering->GetComponent(); Entity* vehicle; Entity* player; @@ -37,7 +37,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std: vehicle = entering; } else if (entering->IsPlayer()) { - auto* possessorComponent = entering->GetComponent(); + auto possessorComponent = entering->GetComponent(); if (possessorComponent == nullptr) { return; @@ -59,7 +59,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std: auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); - auto* racingControlComponent = zoneController->GetComponent(); + auto racingControlComponent = zoneController->GetComponent(); if (racingControlComponent != nullptr) { racingControlComponent->OnRequestDie(player); diff --git a/dScripts/02_server/Map/GF/GfCaptainsCannon.cpp b/dScripts/02_server/Map/GF/GfCaptainsCannon.cpp index c366d0fb..2a0a49d5 100644 --- a/dScripts/02_server/Map/GF/GfCaptainsCannon.cpp +++ b/dScripts/02_server/Map/GF/GfCaptainsCannon.cpp @@ -75,7 +75,7 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) { GameMessages::SendStopFXEffect(player, true, "hook"); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgress(601, 910, 1); diff --git a/dScripts/02_server/Map/GF/GfTikiTorch.cpp b/dScripts/02_server/Map/GF/GfTikiTorch.cpp index 5d944f0f..bfeec36b 100644 --- a/dScripts/02_server/Map/GF/GfTikiTorch.cpp +++ b/dScripts/02_server/Map/GF/GfTikiTorch.cpp @@ -45,7 +45,7 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) { } void GfTikiTorch::LightTorch(Entity* self) { - auto* renderComponent = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto renderComponent = self->GetComponent(); if (renderComponent == nullptr) return; @@ -59,14 +59,14 @@ void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::str if (self->GetBoolean(u"isBurning") && message == "waterspray") { RenderComponent::PlayAnimation(self, u"water"); - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("tikitorch"); renderComponent->PlayEffect(611, u"water", "water"); renderComponent->PlayEffect(611, u"steam", "steam"); } - auto* casterMissionComponent = caster->GetComponent(); + auto casterMissionComponent = caster->GetComponent(); if (casterMissionComponent != nullptr) { for (const auto missionID : m_missions) { casterMissionComponent->ForceProgressTaskType(missionID, static_cast(eMissionTaskType::SCRIPT), 1); diff --git a/dScripts/02_server/Map/GF/MastTeleport.cpp b/dScripts/02_server/Map/GF/MastTeleport.cpp index 311da34a..b2929c14 100644 --- a/dScripts/02_server/Map/GF/MastTeleport.cpp +++ b/dScripts/02_server/Map/GF/MastTeleport.cpp @@ -23,7 +23,7 @@ void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) { GameMessages::SendSetStunned(target->GetObjectID(), eStateChangeType::PUSH, target->GetSystemAddress(), LWOOBJID_EMPTY, true, true, true, true, true, true, true ); - auto* destroyableComponent = target->GetComponent(); + auto destroyableComponent = target->GetComponent(); if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::PUSH, true, true, true, true, true, false, false, true, true); self->AddTimer("Start", 3); @@ -94,7 +94,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) { GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, true, true, true, true, true, true, true ); - auto* destroyableComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::POP, true, true, true, true, true, false, false, true, true); EntityManager::Instance()->SerializeEntity(player); } diff --git a/dScripts/02_server/Map/General/ExplodingAsset.cpp b/dScripts/02_server/Map/General/ExplodingAsset.cpp index ee8f8e68..f0f35eed 100644 --- a/dScripts/02_server/Map/General/ExplodingAsset.cpp +++ b/dScripts/02_server/Map/General/ExplodingAsset.cpp @@ -24,7 +24,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) { if (en->GetObjectID() == attacker->GetObjectID()) { if (Vector3::DistanceSquared(en->GetPosition(), self->GetPosition()) > 10 * 10) continue; - auto* destroyable = en->GetComponent(); + auto destroyable = en->GetComponent(); if (destroyable == nullptr) { continue; } @@ -40,7 +40,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) { GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(147, 4721, LWOOBJID_EMPTY, true); } @@ -49,7 +49,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) { auto achievementIDs = self->GetVar(u"achieveID"); // Progress all scripted missions related to this asset - auto* missionComponent = attacker->GetComponent(); + auto missionComponent = attacker->GetComponent(); if (missionComponent != nullptr) { if (missionID != 0) { missionComponent->ForceProgressValue(missionID, @@ -70,7 +70,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) { } void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { - auto* destuctableComponent = entering->GetComponent(); + auto destuctableComponent = entering->GetComponent(); if (destuctableComponent == nullptr) return; diff --git a/dScripts/02_server/Map/General/ForceVolumeServer.cpp b/dScripts/02_server/Map/General/ForceVolumeServer.cpp index ed9024c1..693e0cdc 100644 --- a/dScripts/02_server/Map/General/ForceVolumeServer.cpp +++ b/dScripts/02_server/Map/General/ForceVolumeServer.cpp @@ -4,7 +4,7 @@ #include "ePhysicsEffectType.h" void ForceVolumeServer::OnStartup(Entity* self) { - auto* phantomPhysicsComponent = self->GetComponent(); + auto phantomPhysicsComponent = self->GetComponent(); if (phantomPhysicsComponent == nullptr) return; diff --git a/dScripts/02_server/Map/General/GrowingFlower.cpp b/dScripts/02_server/Map/General/GrowingFlower.cpp index ad88528f..53da85ff 100644 --- a/dScripts/02_server/Map/General/GrowingFlower.cpp +++ b/dScripts/02_server/Map/General/GrowingFlower.cpp @@ -15,7 +15,7 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s LootGenerator::Instance().DropActivityLoot(target, self, self->GetLOT(), 0); - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent != nullptr) { for (const auto mission : achievementIDs) missionComponent->ForceProgressTaskType(mission, static_cast(eMissionTaskType::SCRIPT), 1); diff --git a/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp b/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp index 8b3da9fa..fc3a885e 100644 --- a/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp +++ b/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp @@ -12,7 +12,7 @@ void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* cast if (healMission == 0) return; - auto* missionComponent = caster->GetComponent(); + auto missionComponent = caster->GetComponent(); if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == eMissionState::ACTIVE) { missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ClearMaelstrom", 0, 0, diff --git a/dScripts/02_server/Map/General/Ninjago/NjRailActivatorsServer.cpp b/dScripts/02_server/Map/General/Ninjago/NjRailActivatorsServer.cpp index 5ca726af..a38f15ac 100644 --- a/dScripts/02_server/Map/General/Ninjago/NjRailActivatorsServer.cpp +++ b/dScripts/02_server/Map/General/Ninjago/NjRailActivatorsServer.cpp @@ -4,7 +4,7 @@ void NjRailActivatorsServer::OnUse(Entity* self, Entity* user) { const auto flag = self->GetVar(u"RailFlagNum"); - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); // Only allow use if this is not a quick build or the quick build is built if (rebuildComponent == nullptr || rebuildComponent->GetState() == eRebuildState::COMPLETED) { diff --git a/dScripts/02_server/Map/General/Ninjago/NjRailPostServer.cpp b/dScripts/02_server/Map/General/Ninjago/NjRailPostServer.cpp index 2c435705..85d7b3f0 100644 --- a/dScripts/02_server/Map/General/Ninjago/NjRailPostServer.cpp +++ b/dScripts/02_server/Map/General/Ninjago/NjRailPostServer.cpp @@ -3,7 +3,7 @@ #include "EntityManager.h" void NjRailPostServer::OnStartup(Entity* self) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent != nullptr) { self->SetNetworkVar(NetworkNotActiveVariable, true); } diff --git a/dScripts/02_server/Map/General/PetDigServer.cpp b/dScripts/02_server/Map/General/PetDigServer.cpp index 8c819a8d..6d55f373 100644 --- a/dScripts/02_server/Map/General/PetDigServer.cpp +++ b/dScripts/02_server/Map/General/PetDigServer.cpp @@ -125,7 +125,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe // If the player doesn't have the flag yet if (playerFlag != 0 && !player->GetPlayerFlag(playerFlag)) { - auto* petComponent = pet->GetComponent(); + auto petComponent = pet->GetComponent(); if (petComponent != nullptr) { // TODO: Pet state = 9 ?? } @@ -159,7 +159,7 @@ void PetDigServer::HandleBouncerDig(const Entity* self, const Entity* owner) { * \param owner the owner that just made a pet dig something up */ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* chest) { - auto* missionComponent = owner->GetComponent(); + auto missionComponent = owner->GetComponent(); if (missionComponent != nullptr) { // Can You Dig It progress @@ -193,7 +193,7 @@ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* che void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo digInfo) { // Some treasures require a mission to be active if (digInfo.requiredMission >= 0) { - auto* missionComponent = owner->GetComponent(); + auto missionComponent = owner->GetComponent(); if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) { return; } diff --git a/dScripts/02_server/Map/General/PropertyDevice.cpp b/dScripts/02_server/Map/General/PropertyDevice.cpp index 0ad9f5c9..b0bd3fc2 100644 --- a/dScripts/02_server/Map/General/PropertyDevice.cpp +++ b/dScripts/02_server/Map/General/PropertyDevice.cpp @@ -16,7 +16,7 @@ void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) { if (propertyOwnerID == std::to_string(LWOOBJID_EMPTY)) return; - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent != nullptr) { if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) { GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome"); diff --git a/dScripts/02_server/Map/General/PropertyPlatform.cpp b/dScripts/02_server/Map/General/PropertyPlatform.cpp index 7016db94..a26d7473 100644 --- a/dScripts/02_server/Map/General/PropertyPlatform.cpp +++ b/dScripts/02_server/Map/General/PropertyPlatform.cpp @@ -4,7 +4,7 @@ #include "MovingPlatformComponent.h" void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) { - // auto* movingPlatform = self->GetComponent(); + // auto movingPlatform = self->GetComponent(); // if (movingPlatform != nullptr) { // movingPlatform->StopPathing(); // movingPlatform->SetNoAutoStart(true); @@ -14,9 +14,9 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) { } void PropertyPlatform::OnUse(Entity* self, Entity* user) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::COMPLETED) { - // auto* movingPlatform = self->GetComponent(); + // auto movingPlatform = self->GetComponent(); // if (movingPlatform != nullptr) { // movingPlatform->GotoWaypoint(1); // } diff --git a/dScripts/02_server/Map/General/QbEnemyStunner.cpp b/dScripts/02_server/Map/General/QbEnemyStunner.cpp index 441d743c..dc7742f3 100644 --- a/dScripts/02_server/Map/General/QbEnemyStunner.cpp +++ b/dScripts/02_server/Map/General/QbEnemyStunner.cpp @@ -7,7 +7,7 @@ #include "CDSkillBehaviorTable.h" void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) { - auto* destroyable = self->GetComponent(); + auto destroyable = self->GetComponent(); if (destroyable != nullptr) { destroyable->SetFaction(115); @@ -51,7 +51,7 @@ void QbEnemyStunner::OnTimerDone(Entity* self, std::string timerName) { self->AddTimer("DieTime", 5.0f); } else if (timerName == "TickTime") { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { auto skillBehaviorMap = self->GetVar>(u"skillBehaviorMap"); diff --git a/dScripts/02_server/Map/General/QbSpawner.cpp b/dScripts/02_server/Map/General/QbSpawner.cpp index d5c9d001..7825e310 100644 --- a/dScripts/02_server/Map/General/QbSpawner.cpp +++ b/dScripts/02_server/Map/General/QbSpawner.cpp @@ -115,14 +115,14 @@ void QbSpawner::OnChildRemoved(Entity* self, Entity* child) { } void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) { - auto* baseCombatAIComponent = enemy->GetComponent(); + auto baseCombatAIComponent = enemy->GetComponent(); if (!baseCombatAIComponent) return; auto gateObjID = self->GetVar(u"gateObj"); if (gateObjID) { auto* gate = EntityManager::Instance()->GetEntity(gateObjID); if (gate) { - auto* movementAIComponent = enemy->GetComponent(); + auto movementAIComponent = enemy->GetComponent(); if (movementAIComponent) movementAIComponent->SetDestination(gate->GetPosition()); baseCombatAIComponent->Taunt(gateObjID, 1000); } diff --git a/dScripts/02_server/Map/General/TokenConsoleServer.cpp b/dScripts/02_server/Map/General/TokenConsoleServer.cpp index e13011cb..3ccd6899 100644 --- a/dScripts/02_server/Map/General/TokenConsoleServer.cpp +++ b/dScripts/02_server/Map/General/TokenConsoleServer.cpp @@ -9,7 +9,7 @@ //2021-05-03 - max - added script, omitted some parts related to inheritance in lua which we don't need void TokenConsoleServer::OnUse(Entity* self, Entity* user) { - auto* inv = static_cast(user->GetComponent(eReplicaComponentType::INVENTORY)); + auto inv = user->GetComponent(); //make sure the user has the required amount of infected bricks if (inv && inv->GetLotCount(6194) >= bricksToTake) { diff --git a/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp b/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp index 7b2495d0..0e6780b9 100644 --- a/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp +++ b/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp @@ -17,7 +17,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target) return; } - auto* missionComponent = static_cast(target->GetComponent(eReplicaComponentType::MISSION)); + auto missionComponent = target->GetComponent(); if (missionComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/General/WishingWellServer.cpp b/dScripts/02_server/Map/General/WishingWellServer.cpp index 58ce1c72..7704a3f3 100644 --- a/dScripts/02_server/Map/General/WishingWellServer.cpp +++ b/dScripts/02_server/Map/General/WishingWellServer.cpp @@ -9,7 +9,7 @@ void WishingWellServer::OnStartup(Entity* self) { } void WishingWellServer::OnUse(Entity* self, Entity* user) { - auto* scriptedActivity = self->GetComponent(); + auto scriptedActivity = self->GetComponent(); if (!scriptedActivity->TakeCost(user)) { return; diff --git a/dScripts/02_server/Map/NS/NsTokenConsoleServer.cpp b/dScripts/02_server/Map/NS/NsTokenConsoleServer.cpp index 326842d2..269e9d6a 100644 --- a/dScripts/02_server/Map/NS/NsTokenConsoleServer.cpp +++ b/dScripts/02_server/Map/NS/NsTokenConsoleServer.cpp @@ -12,7 +12,7 @@ void NsTokenConsoleServer::OnStartup(Entity* self) { } void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent == nullptr) { return; @@ -22,8 +22,8 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) { return; } - auto* inventoryComponent = user->GetComponent(); - auto* missionComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); auto* character = user->GetCharacter(); if (inventoryComponent == nullptr || missionComponent == nullptr || character == nullptr) { diff --git a/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp b/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp index 99bc0de5..9b7e1248 100644 --- a/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp +++ b/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp @@ -24,7 +24,7 @@ void NtAssemblyTubeServer::OnProximityUpdate(Entity* self, Entity* entering, std RunAssemblyTube(self, player); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); diff --git a/dScripts/02_server/Map/NT/NtCombatChallengeServer.cpp b/dScripts/02_server/Map/NT/NtCombatChallengeServer.cpp index d27ac1f6..30366b55 100644 --- a/dScripts/02_server/Map/NT/NtCombatChallengeServer.cpp +++ b/dScripts/02_server/Map/NT/NtCombatChallengeServer.cpp @@ -48,7 +48,7 @@ void NtCombatChallengeServer::OnMessageBoxResponse(Entity* self, Entity* sender, self->SetVar(u"playerID", sender->GetObjectID()); - auto* inventoryComponent = sender->GetComponent(); + auto inventoryComponent = sender->GetComponent(); if (inventoryComponent != nullptr) { inventoryComponent->RemoveItem(3039, 1); @@ -133,7 +133,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) { auto* player = EntityManager::Instance()->GetEntity(playerID); if (player != nullptr) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { for (const auto& mission : tMissions) { diff --git a/dScripts/02_server/Map/NT/NtDarkitectRevealServer.cpp b/dScripts/02_server/Map/NT/NtDarkitectRevealServer.cpp index 80ceb91e..b207ae56 100644 --- a/dScripts/02_server/Map/NT/NtDarkitectRevealServer.cpp +++ b/dScripts/02_server/Map/NT/NtDarkitectRevealServer.cpp @@ -6,7 +6,7 @@ void NtDarkitectRevealServer::OnUse(Entity* self, Entity* user) { Darkitect Baron; Baron.Reveal(self, user); - auto* missionComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgressTaskType(1344, 1, 14293); diff --git a/dScripts/02_server/Map/NT/NtDirtCloudServer.cpp b/dScripts/02_server/Map/NT/NtDirtCloudServer.cpp index 92175dea..80935943 100644 --- a/dScripts/02_server/Map/NT/NtDirtCloudServer.cpp +++ b/dScripts/02_server/Map/NT/NtDirtCloudServer.cpp @@ -30,7 +30,7 @@ void NtDirtCloudServer::OnSkillEventFired(Entity* self, Entity* caster, const st const auto& myMis = m_Missions[mySpawner]; - auto* missionComponent = caster->GetComponent(); + auto missionComponent = caster->GetComponent(); if (missionComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/NT/NtDukeServer.cpp b/dScripts/02_server/Map/NT/NtDukeServer.cpp index 07d17e96..352fe4e1 100644 --- a/dScripts/02_server/Map/NT/NtDukeServer.cpp +++ b/dScripts/02_server/Map/NT/NtDukeServer.cpp @@ -24,8 +24,8 @@ void NtDukeServer::SetVariables(Entity* self) { void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { // Handles adding and removing the sword for the Crux Prime Sword mission - auto* missionComponent = target->GetComponent(); - auto* inventoryComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); if (missionComponent != nullptr && inventoryComponent != nullptr) { auto state = missionComponent->GetMissionState(m_SwordMissionID); diff --git a/dScripts/02_server/Map/NT/NtImagBeamBuffer.cpp b/dScripts/02_server/Map/NT/NtImagBeamBuffer.cpp index d98a7403..7ed610d5 100644 --- a/dScripts/02_server/Map/NT/NtImagBeamBuffer.cpp +++ b/dScripts/02_server/Map/NT/NtImagBeamBuffer.cpp @@ -33,7 +33,7 @@ void NtImagBeamBuffer::OnTimerDone(Entity* self, std::string timerName) { return; } - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp b/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp index dcae84d2..03126947 100644 --- a/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp +++ b/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp @@ -15,7 +15,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) { self->SetVar(u"bActive", true); - auto* missionComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); const auto playerID = user->GetObjectID(); diff --git a/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp b/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp index 687a3477..3c07091c 100644 --- a/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp +++ b/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp @@ -43,7 +43,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std: }); } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); diff --git a/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp b/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp index 257bf6da..ce3249bd 100644 --- a/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp +++ b/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp @@ -6,7 +6,7 @@ #include "ePhysicsEffectType.h" void NtSentinelWalkwayServer::OnStartup(Entity* self) { - auto* phantomPhysicsComponent = self->GetComponent(); + auto phantomPhysicsComponent = self->GetComponent(); if (phantomPhysicsComponent == nullptr) { return; @@ -37,7 +37,7 @@ void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering, auto* player = entering; - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); diff --git a/dScripts/02_server/Map/NT/NtSleepingGuard.cpp b/dScripts/02_server/Map/NT/NtSleepingGuard.cpp index 92a80582..b05903fc 100644 --- a/dScripts/02_server/Map/NT/NtSleepingGuard.cpp +++ b/dScripts/02_server/Map/NT/NtSleepingGuard.cpp @@ -20,7 +20,7 @@ void NtSleepingGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* RenderComponent::PlayAnimation(self, u"greet"); - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent != nullptr) { missionComponent->CompleteMission(1346); diff --git a/dScripts/02_server/Map/NT/NtVandaServer.cpp b/dScripts/02_server/Map/NT/NtVandaServer.cpp index 7750d566..bd49e47a 100644 --- a/dScripts/02_server/Map/NT/NtVandaServer.cpp +++ b/dScripts/02_server/Map/NT/NtVandaServer.cpp @@ -6,7 +6,7 @@ void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio // Removes the alien parts after completing the mission if (missionID == m_AlienPartMissionID && missionState == eMissionState::READY_TO_COMPLETE) { - auto* inventoryComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); for (const auto& alienPartLot : m_AlienPartLots) { inventoryComponent->RemoveItem(alienPartLot, 1); } diff --git a/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp b/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp index 07d33555..375d525f 100644 --- a/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp +++ b/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp @@ -15,13 +15,13 @@ void NtVentureSpeedPadServer::OnProximityUpdate(Entity* self, Entity* entering, auto* player = entering; - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } - auto* skillComponent = player->GetComponent(); + auto skillComponent = player->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(927, 18913, player->GetObjectID(), true); diff --git a/dScripts/02_server/Map/NT/NtXRayServer.cpp b/dScripts/02_server/Map/NT/NtXRayServer.cpp index 3b281b79..adef550d 100644 --- a/dScripts/02_server/Map/NT/NtXRayServer.cpp +++ b/dScripts/02_server/Map/NT/NtXRayServer.cpp @@ -2,7 +2,7 @@ #include "SkillComponent.h" void NtXRayServer::OnCollisionPhantom(Entity* self, Entity* target) { - auto* skillComponent = target->GetComponent(); + auto skillComponent = target->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp b/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp index cf635fe4..755c6a68 100644 --- a/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp +++ b/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp @@ -14,8 +14,8 @@ void SpawnGryphonServer::SetVariables(Entity* self) { } void SpawnGryphonServer::OnUse(Entity* self, Entity* user) { - auto* missionComponent = user->GetComponent(); - auto* inventoryComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); // Little extra for handling the case of the egg being placed the first time if (missionComponent != nullptr && inventoryComponent != nullptr diff --git a/dScripts/02_server/Map/Property/AG_Small/EnemySpiderSpawner.cpp b/dScripts/02_server/Map/Property/AG_Small/EnemySpiderSpawner.cpp index 0d4f568e..07db9a3a 100644 --- a/dScripts/02_server/Map/Property/AG_Small/EnemySpiderSpawner.cpp +++ b/dScripts/02_server/Map/Property/AG_Small/EnemySpiderSpawner.cpp @@ -15,7 +15,7 @@ void EnemySpiderSpawner::OnFireEventServerSide(Entity* self, Entity* sender, std GameMessages::SendPlayFXEffect(self->GetObjectID(), 2856, u"maelstrom", "test", LWOOBJID_EMPTY, 1.0f, 1.0f, true); // Make indestructible - auto dest = static_cast(self->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto dest = self->GetComponent(); if (dest) { dest->SetFaction(-1); } @@ -54,7 +54,7 @@ void EnemySpiderSpawner::OnTimerDone(Entity* self, std::string timerName) { newEntity->GetGroups().push_back("BabySpider"); /* - auto* movementAi = newEntity->GetComponent(); + auto movementAi = newEntity->GetComponent(); movementAi->SetDestination(newEntity->GetPosition()); */ diff --git a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp index 6bf91768..22600430 100644 --- a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp +++ b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp @@ -75,7 +75,7 @@ void ZoneAgProperty::OnPlayerLoaded(Entity* self, Entity* player) { } void ZoneAgProperty::PropGuardCheck(Entity* self, Entity* player) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) return; @@ -211,7 +211,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) { KillGuard(self); } else if (timerName == "tornadoOff") { for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar(FXManagerGroup))) { - auto* renderComponent = entity->GetComponent(); + auto renderComponent = entity->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("TornadoDebris", false); renderComponent->StopEffect("TornadoVortex", false); @@ -223,7 +223,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) { self->AddTimer("ShowClearEffects", 2); } else if (timerName == "ShowClearEffects") { for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar(FXManagerGroup))) { - auto* renderComponent = entity->GetComponent(); + auto renderComponent = entity->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(-1, u"beamOn", "beam"); } @@ -275,7 +275,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) { StartTornadoFx(self); } else if (timerName == "killFXObject") { for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar(FXManagerGroup))) { - auto* renderComponent = entity->GetComponent(); + auto renderComponent = entity->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("beam"); } @@ -301,7 +301,7 @@ void ZoneAgProperty::OnZonePropertyRented(Entity* self, Entity* player) { void ZoneAgProperty::OnZonePropertyModelPlaced(Entity* self, Entity* player) { auto* character = player->GetCharacter(); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (!character->GetPlayerFlag(101)) { BaseZonePropertyModelPlaced(self, player); @@ -329,7 +329,7 @@ void ZoneAgProperty::OnZonePropertyModelPlaced(Entity* self, Entity* player) { void ZoneAgProperty::OnZonePropertyModelPickedUp(Entity* self, Entity* player) { auto* character = player->GetCharacter(); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (!character->GetPlayerFlag(109)) { character->SetPlayerFlag(109, true); @@ -350,7 +350,7 @@ void ZoneAgProperty::OnZonePropertyModelRemovedWhileEquipped(Entity* self, Entit void ZoneAgProperty::OnZonePropertyModelRotated(Entity* self, Entity* player) { auto* character = player->GetCharacter(); - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (!character->GetPlayerFlag(110)) { character->SetPlayerFlag(110, true); diff --git a/dScripts/02_server/Map/SS/SsModularBuildServer.cpp b/dScripts/02_server/Map/SS/SsModularBuildServer.cpp index dfb29168..2c395f9b 100644 --- a/dScripts/02_server/Map/SS/SsModularBuildServer.cpp +++ b/dScripts/02_server/Map/SS/SsModularBuildServer.cpp @@ -7,7 +7,7 @@ void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool int missionNum = 1732; if (bCompleted) { - MissionComponent* mission = static_cast(player->GetComponent(eReplicaComponentType::MISSION)); + auto mission = self->GetComponent(); Mission* rocketMission = mission->GetMission(missionNum); if (rocketMission->GetMissionState() == eMissionState::ACTIVE) { diff --git a/dScripts/02_server/Map/VE/VeBricksampleServer.cpp b/dScripts/02_server/Map/VE/VeBricksampleServer.cpp index 0ead6a87..e0f3441e 100644 --- a/dScripts/02_server/Map/VE/VeBricksampleServer.cpp +++ b/dScripts/02_server/Map/VE/VeBricksampleServer.cpp @@ -6,10 +6,10 @@ #include "eMissionState.h" void VeBricksampleServer::OnUse(Entity* self, Entity* user) { - auto* missionComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == eMissionState::ACTIVE) { const auto loot = self->GetVar(m_LootVariable); - auto* inventoryComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) { inventoryComponent->AddItem(loot, 1, eLootSourceType::ACTIVITY); diff --git a/dScripts/02_server/Map/VE/VeMissionConsole.cpp b/dScripts/02_server/Map/VE/VeMissionConsole.cpp index 35061bdf..b1694912 100644 --- a/dScripts/02_server/Map/VE/VeMissionConsole.cpp +++ b/dScripts/02_server/Map/VE/VeMissionConsole.cpp @@ -8,7 +8,7 @@ void VeMissionConsole::OnUse(Entity* self, Entity* user) { LootGenerator::Instance().DropActivityLoot(user, self, 12551); - auto* inventoryComponent = user->GetComponent(); + auto inventoryComponent = user->GetComponent(); if (inventoryComponent != nullptr) { inventoryComponent->AddItem(12547, 1, eLootSourceType::ACTIVITY); // Add the panel required for pickup } diff --git a/dScripts/02_server/Map/njhub/BurningTile.cpp b/dScripts/02_server/Map/njhub/BurningTile.cpp index 8ac3dc5d..acda9784 100644 --- a/dScripts/02_server/Map/njhub/BurningTile.cpp +++ b/dScripts/02_server/Map/njhub/BurningTile.cpp @@ -3,7 +3,7 @@ void BurningTile::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "PlayerEntered") { - auto* skillComponent = sender->GetComponent(); + auto skillComponent = sender->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/CavePrisonCage.cpp b/dScripts/02_server/Map/njhub/CavePrisonCage.cpp index d04fc03d..7c7a2e03 100644 --- a/dScripts/02_server/Map/njhub/CavePrisonCage.cpp +++ b/dScripts/02_server/Map/njhub/CavePrisonCage.cpp @@ -68,7 +68,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) { self->SetVar(u"Counterweight", counterweight->GetObjectID()); - auto* rebuildComponent = counterweight->GetComponent(); + auto rebuildComponent = counterweight->GetComponent(); if (rebuildComponent != nullptr) { rebuildComponent->AddRebuildStateCallback([this, self](eRebuildState state) { diff --git a/dScripts/02_server/Map/njhub/EnemySkeletonSpawner.cpp b/dScripts/02_server/Map/njhub/EnemySkeletonSpawner.cpp index 0e2e4005..e01132fd 100644 --- a/dScripts/02_server/Map/njhub/EnemySkeletonSpawner.cpp +++ b/dScripts/02_server/Map/njhub/EnemySkeletonSpawner.cpp @@ -7,7 +7,7 @@ void EnemySkeletonSpawner::OnStartup(Entity* self) { self->SetProximityRadius(15, "ronin"); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(1127, 24812, LWOOBJID_EMPTY, true); @@ -16,7 +16,7 @@ void EnemySkeletonSpawner::OnStartup(Entity* self) { void EnemySkeletonSpawner::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "hatchTime") { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(644, u"create", "BurstFX1"); @@ -48,7 +48,7 @@ void EnemySkeletonSpawner::OnProximityUpdate(Entity* self, Entity* entering, std if (entering->IsPlayer() && name == "ronin" && status == "ENTER" && !self->GetVar(u"hatching")) { StartHatching(self); - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(305, 3568, LWOOBJID_EMPTY); @@ -65,7 +65,7 @@ void EnemySkeletonSpawner::OnHit(Entity* self, Entity* attacker) { void EnemySkeletonSpawner::StartHatching(Entity* self) { self->SetVar(u"hatching", true); - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(9017, u"cast", "WakeUpFX1"); diff --git a/dScripts/02_server/Map/njhub/FallingTile.cpp b/dScripts/02_server/Map/njhub/FallingTile.cpp index 7804c8bc..3dda9030 100644 --- a/dScripts/02_server/Map/njhub/FallingTile.cpp +++ b/dScripts/02_server/Map/njhub/FallingTile.cpp @@ -3,7 +3,7 @@ #include "GameMessages.h" void FallingTile::OnStartup(Entity* self) { - auto* movingPlatfromComponent = self->GetComponent(); + auto movingPlatfromComponent = self->GetComponent(); if (movingPlatfromComponent == nullptr) { return; @@ -31,7 +31,7 @@ void FallingTile::OnWaypointReached(Entity* self, uint32_t waypointIndex) { } void FallingTile::OnTimerDone(Entity* self, std::string timerName) { - auto* movingPlatfromComponent = self->GetComponent(); + auto movingPlatfromComponent = self->GetComponent(); if (movingPlatfromComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/FlameJetServer.cpp b/dScripts/02_server/Map/njhub/FlameJetServer.cpp index 771dd841..32e2a0ea 100644 --- a/dScripts/02_server/Map/njhub/FlameJetServer.cpp +++ b/dScripts/02_server/Map/njhub/FlameJetServer.cpp @@ -19,7 +19,7 @@ void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target) { return; } - auto* skillComponent = target->GetComponent(); + auto skillComponent = target->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/ImaginationShrineServer.cpp b/dScripts/02_server/Map/njhub/ImaginationShrineServer.cpp index 1fbfad98..79022586 100644 --- a/dScripts/02_server/Map/njhub/ImaginationShrineServer.cpp +++ b/dScripts/02_server/Map/njhub/ImaginationShrineServer.cpp @@ -3,7 +3,7 @@ void ImaginationShrineServer::OnUse(Entity* self, Entity* user) { // If the rebuild component is complete, use the shrine - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/Lieutenant.cpp b/dScripts/02_server/Map/njhub/Lieutenant.cpp index d3b0fc1f..26b5f85d 100644 --- a/dScripts/02_server/Map/njhub/Lieutenant.cpp +++ b/dScripts/02_server/Map/njhub/Lieutenant.cpp @@ -3,7 +3,7 @@ #include "dZoneManager.h" void Lieutenant::OnStartup(Entity* self) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/NjColeNPC.cpp b/dScripts/02_server/Map/njhub/NjColeNPC.cpp index b989f3ee..dc33595b 100644 --- a/dScripts/02_server/Map/njhub/NjColeNPC.cpp +++ b/dScripts/02_server/Map/njhub/NjColeNPC.cpp @@ -8,7 +8,7 @@ void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) { return; } - auto* inventoryComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); if (inventoryComponent == nullptr) { return; @@ -18,7 +18,7 @@ void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) { return; } - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent == nullptr) { return; @@ -31,8 +31,8 @@ void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState); if (missionID == 1818 && missionState >= eMissionState::READY_TO_COMPLETE) { - auto* missionComponent = target->GetComponent(); - auto* inventoryComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); if (missionComponent == nullptr || inventoryComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/NjDragonEmblemChestServer.cpp b/dScripts/02_server/Map/njhub/NjDragonEmblemChestServer.cpp index 931cfe56..cb2bd9be 100644 --- a/dScripts/02_server/Map/njhub/NjDragonEmblemChestServer.cpp +++ b/dScripts/02_server/Map/njhub/NjDragonEmblemChestServer.cpp @@ -12,7 +12,7 @@ void NjDragonEmblemChestServer::OnUse(Entity* self, Entity* user) { character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, false); } - auto* destroyable = self->GetComponent(); + auto destroyable = self->GetComponent(); if (destroyable != nullptr) { LootGenerator::Instance().DropLoot(user, self, destroyable->GetLootMatrixID(), 0, 0); } diff --git a/dScripts/02_server/Map/njhub/NjEarthPetServer.cpp b/dScripts/02_server/Map/njhub/NjEarthPetServer.cpp index 36655c63..b8bdaf69 100644 --- a/dScripts/02_server/Map/njhub/NjEarthPetServer.cpp +++ b/dScripts/02_server/Map/njhub/NjEarthPetServer.cpp @@ -2,7 +2,7 @@ #include "PetComponent.h" void NjEarthPetServer::OnStartup(Entity* self) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwnerId() != LWOOBJID_EMPTY) return; diff --git a/dScripts/02_server/Map/njhub/NjScrollChestServer.cpp b/dScripts/02_server/Map/njhub/NjScrollChestServer.cpp index 7156b368..9432161d 100644 --- a/dScripts/02_server/Map/njhub/NjScrollChestServer.cpp +++ b/dScripts/02_server/Map/njhub/NjScrollChestServer.cpp @@ -5,7 +5,7 @@ void NjScrollChestServer::OnUse(Entity* self, Entity* user) { const auto keyLOT = self->GetVar(u"KeyNum"); const auto rewardItemLOT = self->GetVar(u"openItemID"); - auto* playerInventory = user->GetComponent(); + auto playerInventory = user->GetComponent(); if (playerInventory != nullptr && playerInventory->GetLotCount(keyLOT) == 1) { // Check for the key and remove diff --git a/dScripts/02_server/Map/njhub/NjWuNPC.cpp b/dScripts/02_server/Map/njhub/NjWuNPC.cpp index f4969074..cc1fcad8 100644 --- a/dScripts/02_server/Map/njhub/NjWuNPC.cpp +++ b/dScripts/02_server/Map/njhub/NjWuNPC.cpp @@ -11,7 +11,7 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, e // The Dragon statue daily mission if (missionID == m_MainDragonMissionID) { auto* character = target->GetCharacter(); - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (character == nullptr || missionComponent == nullptr) return; diff --git a/dScripts/02_server/Map/njhub/RainOfArrows.cpp b/dScripts/02_server/Map/njhub/RainOfArrows.cpp index b7c4c074..10f5c4a4 100644 --- a/dScripts/02_server/Map/njhub/RainOfArrows.cpp +++ b/dScripts/02_server/Map/njhub/RainOfArrows.cpp @@ -43,7 +43,7 @@ void RainOfArrows::OnTimerDone(Entity* self, std::string timerName) { return; } - auto* skillComponent = child->GetComponent(); + auto skillComponent = child->GetComponent(); if (skillComponent == nullptr) { return; diff --git a/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp b/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp index 9f129ce3..8e676167 100644 --- a/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp +++ b/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp @@ -51,7 +51,7 @@ void NjMonastryBossInstance::OnPlayerLoaded(Entity* self, Entity* player) { UpdatePlayer(self, player->GetObjectID()); // Buff the player - auto* destroyableComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetHealth((int32_t)destroyableComponent->GetMaxHealth()); destroyableComponent->SetArmor((int32_t)destroyableComponent->GetMaxArmor()); @@ -147,7 +147,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string } else if (timerName + TimerSplitChar == UnstunTimer) { auto* entity = EntityManager::Instance()->GetEntity(objectID); if (entity != nullptr) { - auto* combatAI = entity->GetComponent(); + auto combatAI = entity->GetComponent(); if (combatAI != nullptr) { combatAI->SetDisabled(false); } @@ -221,7 +221,7 @@ void NjMonastryBossInstance::HandleLedgedFrakjawSpawned(Entity* self, Entity* le } void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* counterWeight) { - auto* rebuildComponent = counterWeight->GetComponent(); + auto rebuildComponent = counterWeight->GetComponent(); if (rebuildComponent != nullptr) { rebuildComponent->AddRebuildStateCallback([this, self, counterWeight](eRebuildState state) { @@ -257,7 +257,7 @@ void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* co return; } - auto* skillComponent = frakjaw->GetComponent(); + auto skillComponent = frakjaw->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(1635, 39097, frakjaw->GetObjectID(), true, false); } @@ -285,12 +285,12 @@ void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* low RenderComponent::PlayAnimation(lowerFrakjaw, TeleportInAnimation); self->SetVar(LowerFrakjawVariable, lowerFrakjaw->GetObjectID()); - auto* combatAI = lowerFrakjaw->GetComponent(); + auto combatAI = lowerFrakjaw->GetComponent(); if (combatAI != nullptr) { combatAI->SetDisabled(true); } - auto* destroyableComponent = lowerFrakjaw->GetComponent(); + auto destroyableComponent = lowerFrakjaw->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->AddOnHitCallback([this, self, lowerFrakjaw](Entity* attacker) { NjMonastryBossInstance::HandleLowerFrakjawHit(self, lowerFrakjaw, attacker); @@ -323,7 +323,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* low } void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFrakjaw, Entity* attacker) { - auto* destroyableComponent = lowerFrakjaw->GetComponent(); + auto destroyableComponent = lowerFrakjaw->GetComponent(); if (destroyableComponent == nullptr) return; @@ -332,7 +332,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFr self->SetVar(OnLastWaveVarbiale, true); // Stun frakjaw during the cinematic - auto* combatAI = lowerFrakjaw->GetComponent(); + auto combatAI = lowerFrakjaw->GetComponent(); if (combatAI != nullptr) { combatAI->SetDisabled(true); } @@ -347,7 +347,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFr newTrashMobs.push_back(trashMobID); // Stun all the enemies until the cinematic is over - auto* trashMobCombatAI = trashMob->GetComponent(); + auto trashMobCombatAI = trashMob->GetComponent(); if (trashMobCombatAI != nullptr) { trashMobCombatAI->SetDisabled(true); } @@ -375,7 +375,7 @@ void NjMonastryBossInstance::HandleWaveEnemySpawned(Entity* self, Entity* waveEn waveEnemies.push_back(waveEnemy->GetObjectID()); self->SetVar>(TrashMobsAliveVariable, waveEnemies); - auto* combatAI = waveEnemy->GetComponent(); + auto combatAI = waveEnemy->GetComponent(); if (combatAI != nullptr) { combatAI->SetDisabled(true); ActivityTimerStart(self, UnstunTimer + std::to_string(waveEnemy->GetObjectID()), 3.0f, 3.0f); @@ -436,7 +436,7 @@ void NjMonastryBossInstance::RemovePoison(Entity* self) { auto* player = EntityManager::Instance()->GetEntity(playerID); if (player != nullptr) { - auto* buffComponent = player->GetComponent(); + auto buffComponent = player->GetComponent(); if (buffComponent != nullptr) { buffComponent->RemoveBuff(PoisonBuff); } diff --git a/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp b/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp index 7df8fc12..f944b343 100644 --- a/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp +++ b/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp @@ -6,7 +6,7 @@ #include "Loot.h" void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return; @@ -57,7 +57,7 @@ void MinigameTreasureChestServer::OnStartup(Entity* self) { // BONS treasure chest thinks it's on FV, causing it to start a lobby if (dZoneManager::Instance()->GetZoneID().GetMapID() == 1204) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac != nullptr) { sac->SetInstanceMapID(1204); } diff --git a/dScripts/02_server/Pets/DamagingPets.cpp b/dScripts/02_server/Pets/DamagingPets.cpp index 6fd8c560..5d4bf0ea 100644 --- a/dScripts/02_server/Pets/DamagingPets.cpp +++ b/dScripts/02_server/Pets/DamagingPets.cpp @@ -8,7 +8,7 @@ void DamagingPets::OnStartup(Entity* self) { // Make the pet hostile or non-hostile based on whether or not it is tamed - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent != nullptr && petComponent->GetOwner() == nullptr) { self->AddTimer("GoEvil", 0.5f); } @@ -19,9 +19,9 @@ void DamagingPets::OnPlayerLoaded(Entity* self, Entity* player) { // Makes it so that new players also see the effect self->AddCallbackTimer(2.5f, [self]() { if (self != nullptr) { - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent != nullptr && petComponent->GetOwner() == nullptr && self->GetVar(u"IsEvil")) { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { auto counter = 1; for (const auto petEffect : GetPetInfo(self).effect) { @@ -58,7 +58,7 @@ void DamagingPets::OnSkillEventFired(Entity* self, Entity* caster, const std::st if (infoForPet.skill == message) { // Only make pets tamable that aren't tamed yet - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent != nullptr && petComponent->GetOwner() == nullptr && self->GetVar(u"IsEvil")) { ClearEffects(self); self->AddTimer("GoEvil", 30.0f); @@ -74,7 +74,7 @@ void DamagingPets::OnTimerDone(Entity* self, std::string message) { } void DamagingPets::MakeUntamable(Entity* self) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); // If the pet is currently not being tamed, make it hostile if (petComponent != nullptr && petComponent->GetStatus() != 5) { @@ -82,19 +82,19 @@ void DamagingPets::MakeUntamable(Entity* self) { self->SetVar(u"IsEvil", true); petComponent->SetStatus(1); - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(false); } // Special faction that can attack the player but the player can't attack - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetFaction(114); destroyableComponent->SetHealth(5); } - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { auto counter = 1; for (const auto petEffect : GetPetInfo(self).effect) { @@ -108,22 +108,22 @@ void DamagingPets::MakeUntamable(Entity* self) { void DamagingPets::ClearEffects(Entity* self) { self->SetVar(u"IsEvil", false); - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent != nullptr) { petComponent->SetStatus(67108866); } - auto* combatAIComponent = self->GetComponent(); + auto combatAIComponent = self->GetComponent(); if (combatAIComponent != nullptr) { combatAIComponent->SetDisabled(true); } - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetFaction(99); } - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { auto counter = 1; for (const auto petEffect : GetPetInfo(self).effect) { diff --git a/dScripts/02_server/Pets/PetFromDigServer.cpp b/dScripts/02_server/Pets/PetFromDigServer.cpp index 525f3e94..6ffb6192 100644 --- a/dScripts/02_server/Pets/PetFromDigServer.cpp +++ b/dScripts/02_server/Pets/PetFromDigServer.cpp @@ -3,7 +3,7 @@ #include "ePetTamingNotifyType.h" void PetFromDigServer::OnStartup(Entity* self) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) return; @@ -21,7 +21,7 @@ void PetFromDigServer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "killself") { // Don't accidentally kill a pet that is already owned - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) return; @@ -35,7 +35,7 @@ void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eP } else if (type == ePetTamingNotifyType::QUIT || type == ePetTamingNotifyType::FAILED) { self->Smash(self->GetObjectID(), eKillType::SILENT); } else if (type == ePetTamingNotifyType::SUCCESS) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr) return; // TODO: Remove custom group? diff --git a/dScripts/02_server/Pets/PetFromObjectServer.cpp b/dScripts/02_server/Pets/PetFromObjectServer.cpp index 0a78d7ec..e362c3f7 100644 --- a/dScripts/02_server/Pets/PetFromObjectServer.cpp +++ b/dScripts/02_server/Pets/PetFromObjectServer.cpp @@ -9,7 +9,7 @@ void PetFromObjectServer::OnStartup(Entity* self) { void PetFromObjectServer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "killSelf") { - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) return; self->Smash(self->GetObjectID(), eKillType::SILENT); diff --git a/dScripts/ActivityManager.cpp b/dScripts/ActivityManager.cpp index 078a7a02..46653a94 100644 --- a/dScripts/ActivityManager.cpp +++ b/dScripts/ActivityManager.cpp @@ -8,12 +8,12 @@ #include "Loot.h" bool ActivityManager::IsPlayerInActivity(Entity* self, LWOOBJID playerID) { - const auto* sac = self->GetComponent(); + const auto sac = self->GetComponent(); return sac != nullptr && sac->IsPlayedBy(playerID); } void ActivityManager::UpdatePlayer(Entity* self, LWOOBJID playerID, const bool remove) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return; @@ -34,7 +34,7 @@ void ActivityManager::SetActivityScore(Entity* self, LWOOBJID playerID, uint32_t void ActivityManager::SetActivityValue(Entity* self, const LWOOBJID playerID, const uint32_t valueIndex, const float_t value) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return; @@ -42,7 +42,7 @@ void ActivityManager::SetActivityValue(Entity* self, const LWOOBJID playerID, co } float_t ActivityManager::GetActivityValue(Entity* self, const LWOOBJID playerID, const uint32_t valueIndex) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return -1.0f; @@ -53,7 +53,7 @@ void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const const uint32_t value1, const uint32_t value2, bool quit) { int32_t gameID = 0; - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) { gameID = self->GetLOT(); } else { @@ -92,7 +92,7 @@ void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const } bool ActivityManager::TakeActivityCost(const Entity* self, const LWOOBJID playerID) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return false; @@ -104,7 +104,7 @@ bool ActivityManager::TakeActivityCost(const Entity* self, const LWOOBJID player } uint32_t ActivityManager::CalculateActivityRating(Entity* self, const LWOOBJID playerID) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) return 0; @@ -112,7 +112,7 @@ uint32_t ActivityManager::CalculateActivityRating(Entity* self, const LWOOBJID p } uint32_t ActivityManager::GetActivityID(const Entity* self) { - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); return sac != nullptr ? sac->GetActivityID() : 0; } @@ -147,7 +147,7 @@ float_t ActivityManager::ActivityTimerGetCurrentTime(Entity* self, const std::st int32_t ActivityManager::GetGameID(Entity* self) const { int32_t gameID = 0; - auto* sac = self->GetComponent(); + auto sac = self->GetComponent(); if (sac == nullptr) { gameID = self->GetLOT(); } else { diff --git a/dScripts/BasePropertyServer.cpp b/dScripts/BasePropertyServer.cpp index 72cce09f..618e6fd4 100644 --- a/dScripts/BasePropertyServer.cpp +++ b/dScripts/BasePropertyServer.cpp @@ -95,7 +95,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) { const auto& mapID = dZoneManager::Instance()->GetZone()->GetZoneID(); if (propertyOwner > 0) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress( @@ -149,7 +149,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) { } void BasePropertyServer::PropGuardCheck(Entity* self, Entity* player) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr && missionComponent->GetMissionState(self->GetVar(guardMissionFlag)) != eMissionState::COMPLETE) { @@ -241,7 +241,7 @@ void BasePropertyServer::StartTornadoFx(Entity* self) const { } for (auto* entity : entities) { - auto* renderComponent = entity->GetComponent(); + auto renderComponent = entity->GetComponent(); if (renderComponent != nullptr) { renderComponent->PlayEffect(-1, u"debrisOn", "TornadoDebris"); renderComponent->PlayEffect(-1, u"VortexOn", "TornadoVortex"); @@ -270,7 +270,7 @@ void BasePropertyServer::KillGuard(Entity* self) { } void BasePropertyServer::RequestDie(Entity* self, Entity* other) { - auto* destroyable = other->GetComponent(); + auto destroyable = other->GetComponent(); if (destroyable == nullptr) return; @@ -344,7 +344,7 @@ void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerNam auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar(FXManagerGroup)); for (auto* fxManager : fxManagers) { - auto* renderComponent = fxManager->GetComponent(); + auto renderComponent = fxManager->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("TornadoDebris", false); renderComponent->StopEffect("TornadoVortex", false); @@ -357,7 +357,7 @@ void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerNam auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar(FXManagerGroup)); for (auto* fxManager : fxManagers) { - auto* renderComponent = fxManager->GetComponent(); + auto renderComponent = fxManager->GetComponent(); if (renderComponent != nullptr) renderComponent->PlayEffect(-1, u"beamOn", "beam"); } @@ -423,7 +423,7 @@ void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerNam } for (auto* fxManager : fxManagers) { - auto* renderComponent = fxManager->GetComponent(); + auto renderComponent = fxManager->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("beam"); } diff --git a/dScripts/BaseSurvivalServer.cpp b/dScripts/BaseSurvivalServer.cpp index 3d72628d..fb9f3484 100644 --- a/dScripts/BaseSurvivalServer.cpp +++ b/dScripts/BaseSurvivalServer.cpp @@ -225,7 +225,7 @@ void BaseSurvivalServer::ResetStats(LWOOBJID playerID) { if (player != nullptr) { // Boost all the player stats when loading in - auto* destroyableComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetHealth(destroyableComponent->GetMaxHealth()); destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor()); @@ -360,7 +360,7 @@ void BaseSurvivalServer::GameOver(Entity* self) { player->Resurrect(); // Update all mission progression - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(), self->GetVar(MissionTypeVariable)); diff --git a/dScripts/BaseWavesServer.cpp b/dScripts/BaseWavesServer.cpp index 00340bd0..c3114cd0 100644 --- a/dScripts/BaseWavesServer.cpp +++ b/dScripts/BaseWavesServer.cpp @@ -228,7 +228,7 @@ void BaseWavesServer::ResetStats(LWOOBJID playerID) { if (player != nullptr) { // Boost all the player stats when loading in - auto* destroyableComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetHealth(destroyableComponent->GetMaxHealth()); destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor()); @@ -372,7 +372,7 @@ void BaseWavesServer::GameOver(Entity* self, bool won) { } // Update all mission progression - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(), self->GetVar(MissionTypeVariable)); } @@ -505,7 +505,7 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3 SetActivityValue(self, playerID, 2, state.waveNumber); // Update player missions - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { for (const auto& missionID : waveMission) { // Get the mission state @@ -560,7 +560,7 @@ void BaseWavesServer::UpdateMissionForAllPlayers(Entity* self, uint32_t missionI for (const auto& playerID : state.players) { auto* player = EntityManager::Instance()->GetEntity(playerID); if (player != nullptr) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) return; // Get the mission state auto missionState = missionComponent->GetMissionState(missionID); diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 5459fd37..c8e64498 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -944,8 +944,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr std::vector CppScripts::GetEntityScripts(Entity* entity) { std::vector scripts; - std::vector comps = entity->GetScriptComponents(); - for (ScriptComponent* scriptComp : comps) { + auto comps = entity->GetScriptComponents(); + for (auto& scriptComp : comps) { if (scriptComp != nullptr) { scripts.push_back(scriptComp->GetScript()); } diff --git a/dScripts/Darkitect.cpp b/dScripts/Darkitect.cpp index b4364332..0ad0b549 100644 --- a/dScripts/Darkitect.cpp +++ b/dScripts/Darkitect.cpp @@ -16,8 +16,8 @@ void Darkitect::Reveal(Entity* self, Entity* player) { if (!player) return; - auto* destroyableComponent = player->GetComponent(); - auto* missionComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); auto* character = player->GetCharacter(); if (destroyableComponent != nullptr && missionComponent != nullptr && character != nullptr) { diff --git a/dScripts/EquipmentScripts/BuccaneerValiantShip.cpp b/dScripts/EquipmentScripts/BuccaneerValiantShip.cpp index 3db214b5..cd68ae1c 100644 --- a/dScripts/EquipmentScripts/BuccaneerValiantShip.cpp +++ b/dScripts/EquipmentScripts/BuccaneerValiantShip.cpp @@ -3,7 +3,7 @@ void BuccaneerValiantShip::OnStartup(Entity* self) { self->AddCallbackTimer(1.0F, [self]() { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); auto* owner = self->GetOwner(); if (skillComponent != nullptr && owner != nullptr) { diff --git a/dScripts/EquipmentScripts/PersonalFortress.cpp b/dScripts/EquipmentScripts/PersonalFortress.cpp index f1fe73ee..2001f579 100644 --- a/dScripts/EquipmentScripts/PersonalFortress.cpp +++ b/dScripts/EquipmentScripts/PersonalFortress.cpp @@ -10,13 +10,13 @@ void PersonalFortress::OnStartup(Entity* self) { auto* owner = self->GetOwner(); self->AddTimer("FireSkill", 1.5); - auto* destroyableComponent = owner->GetComponent(); + auto destroyableComponent = owner->GetComponent(); if (destroyableComponent) destroyableComponent->SetStatusImmunity( eStateChangeType::PUSH, true, true, true, true, true, false, true, false, false ); - auto* controllablePhysicsComponent = owner->GetComponent(); + auto controllablePhysicsComponent = owner->GetComponent(); if (controllablePhysicsComponent) controllablePhysicsComponent->SetStunImmunity( eStateChangeType::PUSH, LWOOBJID_EMPTY, true, true, true, true, true, true @@ -31,13 +31,13 @@ void PersonalFortress::OnStartup(Entity* self) { void PersonalFortress::OnDie(Entity* self, Entity* killer) { auto* owner = self->GetOwner(); - auto* destroyableComponent = owner->GetComponent(); + auto destroyableComponent = owner->GetComponent(); if (destroyableComponent) destroyableComponent->SetStatusImmunity( eStateChangeType::POP, true, true, true, true, true, false, true, false, false ); - auto* controllablePhysicsComponent = owner->GetComponent(); + auto controllablePhysicsComponent = owner->GetComponent(); if (controllablePhysicsComponent) controllablePhysicsComponent->SetStunImmunity( eStateChangeType::POP, LWOOBJID_EMPTY, true, true, true, true, true, true @@ -52,7 +52,7 @@ void PersonalFortress::OnDie(Entity* self, Entity* killer) { void PersonalFortress::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "FireSkill") { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent) skillComponent->CalculateBehavior(650, 13364, LWOOBJID_EMPTY, true, false); } } diff --git a/dScripts/EquipmentScripts/StunImmunity.cpp b/dScripts/EquipmentScripts/StunImmunity.cpp index 0ec956f0..bbb8420e 100644 --- a/dScripts/EquipmentScripts/StunImmunity.cpp +++ b/dScripts/EquipmentScripts/StunImmunity.cpp @@ -4,14 +4,14 @@ #include "eStateChangeType.h" void StunImmunity::OnStartup(Entity* self) { - auto* destroyableComponent = self->GetComponent(); + auto destroyableComponent = self->GetComponent(); if (destroyableComponent) { destroyableComponent->SetStatusImmunity( eStateChangeType::PUSH, false, false, true, true, false, false, false, false, true ); } - auto* controllablePhysicsComponent = self->GetComponent(); + auto controllablePhysicsComponent = self->GetComponent(); if (controllablePhysicsComponent) { controllablePhysicsComponent->SetStunImmunity( eStateChangeType::PUSH, self->GetObjectID(), true diff --git a/dScripts/EquipmentTriggers/CoilBackpackBase.cpp b/dScripts/EquipmentTriggers/CoilBackpackBase.cpp index 4e323a08..decf2282 100644 --- a/dScripts/EquipmentTriggers/CoilBackpackBase.cpp +++ b/dScripts/EquipmentTriggers/CoilBackpackBase.cpp @@ -12,7 +12,7 @@ void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int if (damage > 0) { self->SetVar(u"coilCount", self->GetVar(u"coilCount") + 1); if (self->GetVar(u"coilCount") > 4) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (!skillComponent) return; skillComponent->CastSkill(m_SkillId); self->SetVar(u"coilCount", 0); diff --git a/dScripts/NPCAddRemoveItem.cpp b/dScripts/NPCAddRemoveItem.cpp index 13677072..6a9c7c13 100644 --- a/dScripts/NPCAddRemoveItem.cpp +++ b/dScripts/NPCAddRemoveItem.cpp @@ -3,7 +3,7 @@ #include "eMissionState.h" void NPCAddRemoveItem::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { - auto* inventory = target->GetComponent(); + auto inventory = target->GetComponent(); if (inventory == nullptr) return; diff --git a/dScripts/NtFactionSpyServer.cpp b/dScripts/NtFactionSpyServer.cpp index 5c3d689b..b3cb8e2b 100644 --- a/dScripts/NtFactionSpyServer.cpp +++ b/dScripts/NtFactionSpyServer.cpp @@ -47,8 +47,8 @@ bool NtFactionSpyServer::IsSpy(Entity* self, Entity* possibleSpy) { if (!spyData.missionID || !spyData.flagID || !spyData.itemID) return false; - auto* missionComponent = possibleSpy->GetComponent(); - auto* inventoryComponent = possibleSpy->GetComponent(); + auto missionComponent = possibleSpy->GetComponent(); + auto inventoryComponent = possibleSpy->GetComponent(); auto* character = possibleSpy->GetCharacter(); // A player is a spy if they have the spy mission, have the spy equipment equipped and don't have the spy flag set yet diff --git a/dScripts/ScriptedPowerupSpawner.cpp b/dScripts/ScriptedPowerupSpawner.cpp index 3c1d1cca..c1ceb338 100644 --- a/dScripts/ScriptedPowerupSpawner.cpp +++ b/dScripts/ScriptedPowerupSpawner.cpp @@ -23,7 +23,7 @@ void ScriptedPowerupSpawner::OnTimerDone(Entity* self, std::string message) { // Spawn the required number of powerups auto* owner = EntityManager::Instance()->GetEntity(self->GetSpawnerID()); if (owner != nullptr) { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); for (auto i = 0; i < self->GetVar(u"numberOfPowerups"); i++) { if (renderComponent != nullptr) { renderComponent->PlayEffect(0, u"cast", "N_cast"); diff --git a/dScripts/SpawnPetBaseServer.cpp b/dScripts/SpawnPetBaseServer.cpp index 75b46382..94859d3a 100644 --- a/dScripts/SpawnPetBaseServer.cpp +++ b/dScripts/SpawnPetBaseServer.cpp @@ -61,7 +61,7 @@ bool SpawnPetBaseServer::CheckNumberOfPets(Entity* self, Entity* user) { if (spawnedPet == nullptr) continue; - const auto* petComponent = spawnedPet->GetComponent(); + const auto petComponent = spawnedPet->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) continue; diff --git a/dScripts/ai/ACT/ActMine.cpp b/dScripts/ai/ACT/ActMine.cpp index 9651e13d..13ab27df 100644 --- a/dScripts/ai/ACT/ActMine.cpp +++ b/dScripts/ai/ACT/ActMine.cpp @@ -10,7 +10,7 @@ void ActMine::OnStartup(Entity* self) { void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state) { if (state == eRebuildState::COMPLETED) { - auto* rebuild = self->GetComponent(); + auto rebuild = self->GetComponent(); if (rebuild) { auto* builder = rebuild->GetBuilder(); self->SetVar(u"Builder", builder->GetObjectID()); @@ -24,7 +24,7 @@ void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state) { } void ActMine::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { - auto* detroyable = self->GetComponent(); + auto detroyable = self->GetComponent(); if (!detroyable) return; if (status == "ENTER" && self->GetVar(u"RebuildComplete") == true && detroyable->IsEnemy(entering)) { GameMessages::SendPlayFXEffect(self->GetObjectID(), 242, u"orange", "sirenlight_B"); @@ -35,7 +35,7 @@ void ActMine::OnProximityUpdate(Entity* self, Entity* entering, std::string name void ActMine::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "Tick") { if (self->GetVar(u"NumWarnings") >= MAX_WARNINGS) { - auto* skill = self->GetComponent(); + auto skill = self->GetComponent(); if (!skill) return; skill->CalculateBehavior(SKILL_ID, BEHAVIOR_ID, LWOOBJID_EMPTY); self->AddTimer("BlowedUp", BLOWED_UP_TIME); diff --git a/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp b/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp index 76c0289e..c841a39f 100644 --- a/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp +++ b/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp @@ -8,7 +8,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { - auto* possessableComponent = target->GetComponent(); + auto possessableComponent = target->GetComponent(); Entity* vehicle; Entity* player; @@ -22,7 +22,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { return; } else if (target->IsPlayer()) { - auto* possessorComponent = target->GetComponent(); + auto possessorComponent = target->GetComponent(); if (possessorComponent == nullptr) { return; @@ -44,7 +44,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); - auto* racingControlComponent = zoneController->GetComponent(); + auto racingControlComponent = zoneController->GetComponent(); if (racingControlComponent != nullptr) { racingControlComponent->OnRequestDie(player); diff --git a/dScripts/ai/AG/AgBusDoor.cpp b/dScripts/ai/AG/AgBusDoor.cpp index 4910d0c5..691e5b94 100644 --- a/dScripts/ai/AG/AgBusDoor.cpp +++ b/dScripts/ai/AG/AgBusDoor.cpp @@ -16,7 +16,7 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na // Make sure only humans are taken into account if (!entering->GetCharacter()) return; - auto* proximityMonitorComponent = self->GetComponent(); + auto proximityMonitorComponent = self->GetComponent(); if (proximityMonitorComponent == nullptr) return; diff --git a/dScripts/ai/AG/AgDarkSpiderling.cpp b/dScripts/ai/AG/AgDarkSpiderling.cpp index 5dbd350a..5ffc5ec7 100644 --- a/dScripts/ai/AG/AgDarkSpiderling.cpp +++ b/dScripts/ai/AG/AgDarkSpiderling.cpp @@ -2,7 +2,7 @@ #include "BaseCombatAIComponent.h" void AgDarkSpiderling::OnStartup(Entity* self) { - auto* combatAI = self->GetComponent(); + auto combatAI = self->GetComponent(); if (combatAI != nullptr) { combatAI->SetStunImmune(true); } diff --git a/dScripts/ai/AG/AgFans.cpp b/dScripts/ai/AG/AgFans.cpp index aaff9c0d..1639bb53 100644 --- a/dScripts/ai/AG/AgFans.cpp +++ b/dScripts/ai/AG/AgFans.cpp @@ -14,7 +14,7 @@ void AgFans::OnStartup(Entity* self) { ToggleFX(self, false); - auto* renderComponent = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto renderComponent = self->GetComponent(); if (renderComponent == nullptr) { return; @@ -27,7 +27,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) { std::string fanGroup = self->GetGroups()[0]; std::vector fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup); - auto* renderComponent = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto renderComponent = self->GetComponent(); if (renderComponent == nullptr) { return; @@ -42,7 +42,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) { self->SetVar(u"on", false); for (Entity* volume : fanVolumes) { - PhantomPhysicsComponent* volumePhys = static_cast(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS)); + auto volumePhys = volume->GetComponent(); if (!volumePhys) continue; volumePhys->SetPhysicsEffectActive(false); EntityManager::Instance()->SerializeEntity(volume); @@ -58,7 +58,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) { self->SetVar(u"on", true); for (Entity* volume : fanVolumes) { - PhantomPhysicsComponent* volumePhys = static_cast(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS)); + auto volumePhys = volume->GetComponent(); if (!volumePhys) continue; volumePhys->SetPhysicsEffectActive(true); EntityManager::Instance()->SerializeEntity(volume); diff --git a/dScripts/ai/AG/AgImagSmashable.cpp b/dScripts/ai/AG/AgImagSmashable.cpp index 5e8331b1..6cd201d9 100644 --- a/dScripts/ai/AG/AgImagSmashable.cpp +++ b/dScripts/ai/AG/AgImagSmashable.cpp @@ -10,7 +10,7 @@ void AgImagSmashable::OnDie(Entity* self, Entity* killer) { bool maxImagGreaterThanZero = false; if (killer) { - DestroyableComponent* dest = static_cast(killer->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto dest = killer->GetComponent(); if (dest) { maxImagGreaterThanZero = dest->GetMaxImagination() > 0; } diff --git a/dScripts/ai/AG/AgJetEffectServer.cpp b/dScripts/ai/AG/AgJetEffectServer.cpp index 0a26069e..d8cb2cdd 100644 --- a/dScripts/ai/AG/AgJetEffectServer.cpp +++ b/dScripts/ai/AG/AgJetEffectServer.cpp @@ -49,7 +49,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) { // so we give proper credit to the builder for the kills from this skill mortar->SetOwnerOverride(builder); - auto* skillComponent = mortar->GetComponent(); + auto skillComponent = mortar->GetComponent(); if (skillComponent) skillComponent->CastSkill(318); } else if (timerName == "CineDone") { GameMessages::SendNotifyClientObject( diff --git a/dScripts/ai/AG/AgStagePlatforms.cpp b/dScripts/ai/AG/AgStagePlatforms.cpp index 9ba4c4b7..03ed41e8 100644 --- a/dScripts/ai/AG/AgStagePlatforms.cpp +++ b/dScripts/ai/AG/AgStagePlatforms.cpp @@ -2,7 +2,7 @@ #include "MovingPlatformComponent.h" void AgStagePlatforms::OnStartup(Entity* self) { - auto* component = self->GetComponent(); + auto component = self->GetComponent(); if (component) { component->SetNoAutoStart(true); component->StopPathing(); @@ -10,7 +10,7 @@ void AgStagePlatforms::OnStartup(Entity* self) { } void AgStagePlatforms::OnWaypointReached(Entity* self, uint32_t waypointIndex) { - auto* component = self->GetComponent(); + auto component = self->GetComponent(); if (waypointIndex == 0 && component) component->StopPathing(); } diff --git a/dScripts/ai/FV/ActParadoxPipeFix.cpp b/dScripts/ai/FV/ActParadoxPipeFix.cpp index 10a1e652..99d0a43d 100644 --- a/dScripts/ai/FV/ActParadoxPipeFix.cpp +++ b/dScripts/ai/FV/ActParadoxPipeFix.cpp @@ -19,7 +19,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) { continue; } - auto* rebuildComponent = object->GetComponent(); + auto rebuildComponent = object->GetComponent(); if (rebuildComponent->GetState() == eRebuildState::COMPLETED) { indexCount++; @@ -37,7 +37,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) { auto* player = EntityManager::Instance()->GetEntity(object->GetVar(u"PlayerID")); if (player != nullptr) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgressTaskType(769, 1, 1, false); diff --git a/dScripts/ai/FV/FvBrickPuzzleServer.cpp b/dScripts/ai/FV/FvBrickPuzzleServer.cpp index 887b9a4d..a3673bd8 100644 --- a/dScripts/ai/FV/FvBrickPuzzleServer.cpp +++ b/dScripts/ai/FV/FvBrickPuzzleServer.cpp @@ -59,7 +59,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) { void FvBrickPuzzleServer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "reset") { - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::OPEN) { self->Smash(self->GetObjectID(), eKillType::SILENT); diff --git a/dScripts/ai/FV/FvFlyingCreviceDragon.cpp b/dScripts/ai/FV/FvFlyingCreviceDragon.cpp index cb0fe3d0..c6dbc488 100644 --- a/dScripts/ai/FV/FvFlyingCreviceDragon.cpp +++ b/dScripts/ai/FV/FvFlyingCreviceDragon.cpp @@ -40,7 +40,7 @@ void FvFlyingCreviceDragon::OnTimerDone(Entity* self, std::string timerName) { return; } - auto* skillComponent = group[0]->GetComponent(); + auto skillComponent = group[0]->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(762, 12506, LWOOBJID_EMPTY, true); @@ -79,7 +79,7 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) { return; } - auto* skillComponent = group2[0]->GetComponent(); + auto skillComponent = group2[0]->GetComponent(); if (skillComponent != nullptr) { skillComponent->CalculateBehavior(762, 12506, LWOOBJID_EMPTY); diff --git a/dScripts/ai/FV/FvFreeGfNinjas.cpp b/dScripts/ai/FV/FvFreeGfNinjas.cpp index d690a6f7..c8c2c0af 100644 --- a/dScripts/ai/FV/FvFreeGfNinjas.cpp +++ b/dScripts/ai/FV/FvFreeGfNinjas.cpp @@ -5,7 +5,7 @@ void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID == 705 && missionState == eMissionState::AVAILABLE) { - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent == nullptr) return; @@ -26,7 +26,7 @@ void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missi void FvFreeGfNinjas::OnUse(Entity* self, Entity* user) { // To allow player who already have the mission to progress. - auto* missionComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); if (missionComponent == nullptr) return; diff --git a/dScripts/ai/FV/FvMaelstromGeyser.cpp b/dScripts/ai/FV/FvMaelstromGeyser.cpp index 66aa43dc..736de10e 100644 --- a/dScripts/ai/FV/FvMaelstromGeyser.cpp +++ b/dScripts/ai/FV/FvMaelstromGeyser.cpp @@ -8,7 +8,7 @@ void FvMaelstromGeyser::OnStartup(Entity* self) { void FvMaelstromGeyser::OnTimerDone(Entity* self, std::string timerName) { if (timerName == m_StartSkillTimerName) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true); } if (timerName == m_KillSelfTimerName) { diff --git a/dScripts/ai/FV/FvPandaServer.cpp b/dScripts/ai/FV/FvPandaServer.cpp index f29f7f2e..0d661d53 100644 --- a/dScripts/ai/FV/FvPandaServer.cpp +++ b/dScripts/ai/FV/FvPandaServer.cpp @@ -4,7 +4,7 @@ #include "ePetTamingNotifyType.h" void FvPandaServer::OnStartup(Entity* self) { - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent != nullptr && petComponent->GetOwner() == nullptr) { self->SetNetworkVar(u"pandatamer", std::to_string(self->GetVar(u"tamer"))); self->AddTimer("killSelf", 45); @@ -28,7 +28,7 @@ void FvPandaServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetT void FvPandaServer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "killSelf") { - const auto* petComponent = self->GetComponent(); + const auto petComponent = self->GetComponent(); if (petComponent != nullptr && petComponent->GetOwner() == nullptr) { self->Smash(self->GetObjectID(), eKillType::SILENT); } diff --git a/dScripts/ai/FV/FvPandaSpawnerServer.cpp b/dScripts/ai/FV/FvPandaSpawnerServer.cpp index d7dcabcd..3acea410 100644 --- a/dScripts/ai/FV/FvPandaSpawnerServer.cpp +++ b/dScripts/ai/FV/FvPandaSpawnerServer.cpp @@ -14,7 +14,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) { return; // Check if the player is currently in a footrace - auto* scriptedActivityComponent = raceObjects.at(0)->GetComponent(); + auto scriptedActivityComponent = raceObjects.at(0)->GetComponent(); if (scriptedActivityComponent == nullptr || !scriptedActivityComponent->IsPlayedBy(target)) return; diff --git a/dScripts/ai/FV/TriggerGas.cpp b/dScripts/ai/FV/TriggerGas.cpp index 7e9762e3..fa70b0ae 100644 --- a/dScripts/ai/FV/TriggerGas.cpp +++ b/dScripts/ai/FV/TriggerGas.cpp @@ -36,7 +36,7 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) { auto inventoryComponent = player->GetComponent(); if (inventoryComponent) { if (!inventoryComponent->IsEquipped(this->m_MaelstromHelmet)) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (skillComponent) { skillComponent->CastSkill(this->m_FogDamageSkill, player->GetObjectID()); } diff --git a/dScripts/ai/GENERAL/LegoDieRoll.cpp b/dScripts/ai/GENERAL/LegoDieRoll.cpp index 763a4704..d790e0f9 100644 --- a/dScripts/ai/GENERAL/LegoDieRoll.cpp +++ b/dScripts/ai/GENERAL/LegoDieRoll.cpp @@ -37,7 +37,7 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) { RenderComponent::PlayAnimation(self, u"roll-die-6"); // tracking the It's Truly Random Achievement auto* owner = self->GetOwner(); - auto* missionComponent = owner->GetComponent(); + auto missionComponent = owner->GetComponent(); if (missionComponent != nullptr) { const auto rollMissionState = missionComponent->GetMissionState(756); diff --git a/dScripts/ai/GF/GfArchway.cpp b/dScripts/ai/GF/GfArchway.cpp index 429f62ae..0154c3b5 100644 --- a/dScripts/ai/GF/GfArchway.cpp +++ b/dScripts/ai/GF/GfArchway.cpp @@ -3,6 +3,6 @@ #include "SkillComponent.h" void GfArchway::OnRebuildComplete(Entity* self, Entity* target) { - auto* skillComponent = target->GetComponent(); + auto skillComponent = target->GetComponent(); if (skillComponent) skillComponent->CalculateBehavior(SHIELDING_SKILL, SHIELDING_BEHAVIOR, target->GetObjectID(), true); } diff --git a/dScripts/ai/GF/GfBanana.cpp b/dScripts/ai/GF/GfBanana.cpp index 95a831cd..0c233e86 100644 --- a/dScripts/ai/GF/GfBanana.cpp +++ b/dScripts/ai/GF/GfBanana.cpp @@ -38,7 +38,7 @@ void GfBanana::OnStartup(Entity* self) { } void GfBanana::OnHit(Entity* self, Entity* attacker) { - auto* destroyable = self->GetComponent(); + auto destroyable = self->GetComponent(); destroyable->SetHealth(9999); @@ -58,7 +58,7 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) { bananaEntity->SetPosition(bananaEntity->GetPosition() - NiPoint3::UNIT_Y * 8); - auto* bananaDestroyable = bananaEntity->GetComponent(); + auto bananaDestroyable = bananaEntity->GetComponent(); bananaDestroyable->SetHealth(0); diff --git a/dScripts/ai/GF/GfCampfire.cpp b/dScripts/ai/GF/GfCampfire.cpp index 6a10b39e..8e7e28a1 100644 --- a/dScripts/ai/GF/GfCampfire.cpp +++ b/dScripts/ai/GF/GfCampfire.cpp @@ -11,7 +11,7 @@ void GfCampfire::OnStartup(Entity* self) { self->SetProximityRadius(2.0f, "placeholder"); self->SetBoolean(u"isBurning", true); - auto* render = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto render = self->GetComponent(); if (render == nullptr) return; @@ -21,14 +21,14 @@ void GfCampfire::OnStartup(Entity* self) { void GfCampfire::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "physicsReady") { - auto* render = static_cast(self->GetComponent(eReplicaComponentType::RENDER)); + auto render = self->GetComponent(); render->PlayEffect(295, u"running", "Burn"); } } void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { - auto* skill = self->GetComponent(); + auto skill = self->GetComponent(); if (self->GetBoolean(u"isBurning")) { if (status == "ENTER") { @@ -43,7 +43,7 @@ void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string n //self->SetVar("target", entering->GetObjectID()); - auto* missionComponet = entering->GetComponent(); + auto missionComponet = entering->GetComponent(); if (missionComponet != nullptr) { missionComponet->ForceProgress(440, 658, 1); @@ -65,7 +65,7 @@ void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string n void GfCampfire::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) { if (message == "waterspray" && self->GetVar(u"isBurning")) { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("Burn"); renderComponent->PlayEffect(295, u"idle", "Off"); @@ -91,7 +91,7 @@ void GfCampfire::OnTimerDone(Entity* self, std::string timerName) { } */ } else if (timerName == "FireRestart" && !self->GetVar(u"isBurning")) { - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("Off"); renderComponent->PlayEffect(295, u"running", "Burn"); diff --git a/dScripts/ai/GF/GfJailkeepMission.cpp b/dScripts/ai/GF/GfJailkeepMission.cpp index b8d4cd30..767d7503 100644 --- a/dScripts/ai/GF/GfJailkeepMission.cpp +++ b/dScripts/ai/GF/GfJailkeepMission.cpp @@ -4,7 +4,7 @@ #include "eMissionState.h" void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent == nullptr) return; @@ -25,7 +25,7 @@ void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int mi } void GfJailkeepMission::OnUse(Entity* self, Entity* user) { - auto* missionComponent = user->GetComponent(); + auto missionComponent = user->GetComponent(); if (missionComponent == nullptr) return; diff --git a/dScripts/ai/GF/GfMaelstromGeyser.cpp b/dScripts/ai/GF/GfMaelstromGeyser.cpp index 825307a7..4761c450 100644 --- a/dScripts/ai/GF/GfMaelstromGeyser.cpp +++ b/dScripts/ai/GF/GfMaelstromGeyser.cpp @@ -8,7 +8,7 @@ void GfMaelstromGeyser::OnStartup(Entity* self) { void GfMaelstromGeyser::OnTimerDone(Entity* self, std::string timerName) { if (timerName == m_StartSkillTimerName) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true); } if (timerName == m_KillSelfTimerName) { diff --git a/dScripts/ai/GF/GfParrotCrash.cpp b/dScripts/ai/GF/GfParrotCrash.cpp index 6b76a51d..f8e53e68 100644 --- a/dScripts/ai/GF/GfParrotCrash.cpp +++ b/dScripts/ai/GF/GfParrotCrash.cpp @@ -4,7 +4,7 @@ #include "dLogger.h" void GfParrotCrash::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { - auto* skillComponent = self->GetComponent(); + auto skillComponent = self->GetComponent(); if (args == "Slow") { skillComponent->CalculateBehavior(m_SlowSkillID, m_SlowBehaviorID, sender->GetObjectID()); } else if (args == "Unslow") { diff --git a/dScripts/ai/GF/PetDigBuild.cpp b/dScripts/ai/GF/PetDigBuild.cpp index 504a1199..431bcde5 100644 --- a/dScripts/ai/GF/PetDigBuild.cpp +++ b/dScripts/ai/GF/PetDigBuild.cpp @@ -22,7 +22,7 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) { info.lot = 7410; // Normal GF treasure info.settings.push_back(new LDFData(u"groupID", u"Flag" + flagNumber)); } else { - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent != nullptr && missionComponent->GetMissionState(746) == eMissionState::ACTIVE) { info.lot = 9307; // Special Captain Jack treasure that drops a mission item } else { diff --git a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp index 9543504a..a4786a78 100644 --- a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp +++ b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp @@ -30,7 +30,7 @@ void SGCannon::OnStartup(Entity* self) { self->SetVar(InitialVelocityVariable, {}); self->SetVar(ImpactSkillVariale, constants.impactSkillID); - auto* shootingGalleryComponent = self->GetComponent(); + auto shootingGalleryComponent = self->GetComponent(); if (shootingGalleryComponent != nullptr) { shootingGalleryComponent->SetStaticParams({ Vector3 { -327.8609924316406, 256.8999938964844, 1.6482199430465698 }, @@ -57,7 +57,7 @@ void SGCannon::OnStartup(Entity* self) { self->SetVar(MatrixVariable, 1); self->SetVar(InitVariable, true); - auto* simplePhysicsComponent = self->GetComponent(); + auto simplePhysicsComponent = self->GetComponent(); if (simplePhysicsComponent != nullptr) { simplePhysicsComponent->SetPhysicsMotionState(5); @@ -88,7 +88,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int GameMessages::SendActivityEnter(self->GetObjectID(), player->GetSystemAddress()); - auto* shootingGalleryComponent = self->GetComponent(); + auto shootingGalleryComponent = self->GetComponent(); if (shootingGalleryComponent != nullptr) { shootingGalleryComponent->SetCurrentPlayerID(player->GetObjectID()); @@ -100,7 +100,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int Game::logger->Log("SGCannon", "Shooting gallery component is null"); } - auto* characterComponent = player->GetComponent(); + auto characterComponent = player->GetComponent(); if (characterComponent != nullptr) { characterComponent->SetIsRacing(true); @@ -287,9 +287,7 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) { auto* enemy = EntityManager::Instance()->CreateEntity(info, nullptr, self); EntityManager::Instance()->ConstructEntity(enemy); - auto* movementAI = new MovementAIComponent(enemy, {}); - - enemy->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAI); + auto movementAI = enemy->AddComponent({}); movementAI->SetSpeed(toSpawn.initialSpeed); movementAI->SetCurrentSpeed(toSpawn.initialSpeed); @@ -554,7 +552,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) { percentage = misses / fired; } - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent != nullptr) { missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar(TotalScoreVariable), self->GetObjectID(), "performact_score"); @@ -568,7 +566,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) { self->SetNetworkVar(AudioFinalWaveDoneVariable, true); // Give the player the model rewards they earned - auto* inventory = player->GetComponent(); + auto inventory = player->GetComponent(); if (inventory != nullptr) { for (const auto rewardLot : self->GetVar>(RewardsVariable)) { inventory->AddItem(rewardLot, 1, eLootSourceType::ACTIVITY, eInventoryType::MODELS); @@ -720,7 +718,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) { return; } - auto* inventoryComponent = player->GetComponent(); + auto inventoryComponent = player->GetComponent(); auto equippedItems = inventoryComponent->GetEquippedItems(); @@ -729,7 +727,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) { auto skillID = constants.cannonSkill; auto cooldown = constants.cannonRefireRate; - auto* selfInventoryComponent = self->GetComponent(); + auto selfInventoryComponent = self->GetComponent(); if (inventoryComponent == nullptr) { Game::logger->Log("SGCannon", "Inventory component not found"); @@ -772,7 +770,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) { const auto& constants = GetConstants(); - auto* shootingGalleryComponent = self->GetComponent(); + auto shootingGalleryComponent = self->GetComponent(); if (shootingGalleryComponent == nullptr) { return; diff --git a/dScripts/ai/NP/NpcNpSpacemanBob.cpp b/dScripts/ai/NP/NpcNpSpacemanBob.cpp index 2195f4b4..9fe71e33 100644 --- a/dScripts/ai/NP/NpcNpSpacemanBob.cpp +++ b/dScripts/ai/NP/NpcNpSpacemanBob.cpp @@ -6,9 +6,9 @@ void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionState == eMissionState::READY_TO_COMPLETE && missionID == 173) { - DestroyableComponent* destroyable = static_cast(target->GetComponent(eReplicaComponentType::DESTROYABLE)); + auto destroyable = target->GetComponent(); destroyable->SetImagination(6); - MissionComponent* mission = static_cast(target->GetComponent(eReplicaComponentType::MISSION)); + auto mission = target->GetComponent(); mission->CompleteMission(664); } diff --git a/dScripts/ai/NS/NsConcertInstrument.cpp b/dScripts/ai/NS/NsConcertInstrument.cpp index ba99d4d1..39a45205 100644 --- a/dScripts/ai/NS/NsConcertInstrument.cpp +++ b/dScripts/ai/NS/NsConcertInstrument.cpp @@ -72,7 +72,7 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) { if (activePlayer != nullptr && name == "checkPlayer" && self->GetVar(u"beingPlayed")) { GameMessages::SendNotifyClientObject(self->GetObjectID(), u"checkMovement", 0, 0, activePlayer->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS); - auto* stats = activePlayer->GetComponent(); + auto stats = activePlayer->GetComponent(); if (stats) { if (stats->GetImagination() > 0) { self->AddTimer("checkPlayer", updateFrequency); @@ -81,7 +81,7 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) { } } } else if (activePlayer != nullptr && name == "deductImagination" && self->GetVar(u"beingPlayed")) { - auto* stats = activePlayer->GetComponent(); + auto stats = activePlayer->GetComponent(); if (stats) stats->SetImagination(stats->GetImagination() - instrumentImaginationCost); @@ -93,20 +93,20 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) { activePlayer->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS); } - auto* rebuildComponent = self->GetComponent(); + auto rebuildComponent = self->GetComponent(); if (rebuildComponent != nullptr) rebuildComponent->ResetRebuild(false); self->Smash(self->GetObjectID(), eKillType::VIOLENT); self->SetVar(u"activePlayer", LWOOBJID_EMPTY); } else if (activePlayer != nullptr && name == "achievement") { - auto* missionComponent = activePlayer->GetComponent(); + auto missionComponent = activePlayer->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgress(302, 462, self->GetLOT()); } self->AddTimer("achievement2", 10.0f); } else if (activePlayer != nullptr && name == "achievement2") { - auto* missionComponent = activePlayer->GetComponent(); + auto missionComponent = activePlayer->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgress(602, achievementTaskID.at(GetInstrumentLot(self)), self->GetLOT()); } @@ -127,7 +127,7 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) { }); for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) { - auto* soundTrigger = soundBox->GetComponent(); + auto soundTrigger = soundBox->GetComponent(); if (soundTrigger != nullptr) { soundTrigger->ActivateMusicCue(music.at(instrumentLot)); } @@ -148,7 +148,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) { // Player might be null if they left if (player != nullptr) { - auto* missions = player->GetComponent(); + auto missions = player->GetComponent(); if (missions != nullptr && missions->GetMissionState(176) == eMissionState::ACTIVE) { missions->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } @@ -162,7 +162,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) { self->SetVar(u"beingPlayed", false); for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) { - auto* soundTrigger = soundBox->GetComponent(); + auto soundTrigger = soundBox->GetComponent(); if (soundTrigger != nullptr) { soundTrigger->DeactivateMusicCue(music.at(instrumentLot)); } @@ -173,7 +173,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) { } void NsConcertInstrument::EquipInstruments(Entity* self, Entity* player) { - auto* inventory = player->GetComponent(); + auto inventory = player->GetComponent(); if (inventory != nullptr) { auto equippedItems = inventory->GetEquippedItems(); @@ -216,7 +216,7 @@ void NsConcertInstrument::EquipInstruments(Entity* self, Entity* player) { } void NsConcertInstrument::UnEquipInstruments(Entity* self, Entity* player) { - auto* inventory = player->GetComponent(); + auto inventory = player->GetComponent(); if (inventory != nullptr) { auto equippedItems = inventory->GetEquippedItems(); diff --git a/dScripts/ai/NS/NsConcertQuickBuild.cpp b/dScripts/ai/NS/NsConcertQuickBuild.cpp index 4589ee6a..c27f1b9a 100644 --- a/dScripts/ai/NS/NsConcertQuickBuild.cpp +++ b/dScripts/ai/NS/NsConcertQuickBuild.cpp @@ -103,7 +103,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) { // Move all the platforms so the user can collect the imagination brick const auto movingPlatforms = EntityManager::Instance()->GetEntitiesInGroup("ConcertPlatforms"); for (auto* movingPlatform : movingPlatforms) { - auto* component = movingPlatform->GetComponent(); + auto component = movingPlatform->GetComponent(); if (component) { component->WarpToWaypoint(component->GetLastWaypointIndex()); @@ -132,7 +132,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) { quickBuild->Smash(); }); - auto* destroyableComponent = quickBuild->GetComponent(); + auto destroyableComponent = quickBuild->GetComponent(); if (destroyableComponent) destroyableComponent->SetFaction(-1); } @@ -157,7 +157,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) { } void NsConcertQuickBuild::ProgressStageCraft(Entity* self, Entity* player) { - auto* missionComponent = player->GetComponent(); + auto missionComponent = player->GetComponent(); if (missionComponent) { // Has to be forced as to not accidentally trigger the licensed technician achievement diff --git a/dScripts/ai/NS/NsGetFactionMissionServer.cpp b/dScripts/ai/NS/NsGetFactionMissionServer.cpp index 185bd344..1c42c1f7 100644 --- a/dScripts/ai/NS/NsGetFactionMissionServer.cpp +++ b/dScripts/ai/NS/NsGetFactionMissionServer.cpp @@ -46,7 +46,7 @@ void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID, player->GetCharacter()->SetPlayerFlag(flagID, true); } - MissionComponent* mis = static_cast(player->GetComponent(eReplicaComponentType::MISSION)); + auto mis = player->GetComponent(); for (int mission : factionMissions) { mis->AcceptMission(mission); diff --git a/dScripts/ai/NS/NsJohnnyMissionServer.cpp b/dScripts/ai/NS/NsJohnnyMissionServer.cpp index 107d3c44..9052482f 100644 --- a/dScripts/ai/NS/NsJohnnyMissionServer.cpp +++ b/dScripts/ai/NS/NsJohnnyMissionServer.cpp @@ -4,7 +4,7 @@ void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID == 773 && missionState <= eMissionState::ACTIVE) { - auto* missionComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); if (missionComponent != nullptr) { missionComponent->AcceptMission(774); missionComponent->AcceptMission(775); diff --git a/dScripts/ai/NS/NsModularBuild.cpp b/dScripts/ai/NS/NsModularBuild.cpp index 1922eb17..ed90fbb7 100644 --- a/dScripts/ai/NS/NsModularBuild.cpp +++ b/dScripts/ai/NS/NsModularBuild.cpp @@ -5,7 +5,7 @@ void NsModularBuild::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector modules) { if (bCompleted) { - MissionComponent* mission = static_cast(player->GetComponent(eReplicaComponentType::MISSION)); + auto mission = self->GetComponent(); if (mission->GetMissionState(m_MissionNum) == eMissionState::ACTIVE) { for (LOT mod : modules) { diff --git a/dScripts/ai/NS/WhFans.cpp b/dScripts/ai/NS/WhFans.cpp index 8500e824..d5f8bb65 100644 --- a/dScripts/ai/NS/WhFans.cpp +++ b/dScripts/ai/NS/WhFans.cpp @@ -25,7 +25,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) { std::vector fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup); - auto* renderComponent = self->GetComponent(); + auto renderComponent = self->GetComponent(); if (renderComponent == nullptr) return; diff --git a/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp b/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp index 853da92d..fd6d5113 100644 --- a/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp +++ b/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp @@ -9,8 +9,8 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* character = target->GetCharacter(); - auto* missionComponent = target->GetComponent(); - auto* inventoryComponent = target->GetComponent(); + auto missionComponent = target->GetComponent(); + auto inventoryComponent = target->GetComponent(); const auto state = missionComponent->GetMissionState(320); if (missionID == 768 && missionState == eMissionState::AVAILABLE) { diff --git a/dScripts/ai/PROPERTY/PropertyFXDamage.cpp b/dScripts/ai/PROPERTY/PropertyFXDamage.cpp index 56079384..6071da10 100644 --- a/dScripts/ai/PROPERTY/PropertyFXDamage.cpp +++ b/dScripts/ai/PROPERTY/PropertyFXDamage.cpp @@ -6,8 +6,8 @@ void PropertyFXDamage::OnCollisionPhantom(Entity* self, Entity* target) { if (target == nullptr) return; - auto* skills = self->GetComponent(); - auto* targetStats = target->GetComponent(); + auto skills = self->GetComponent(); + auto targetStats = target->GetComponent(); if (skills != nullptr && targetStats != nullptr) { auto targetFactions = targetStats->GetFactionIDs(); diff --git a/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp b/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp index f69a3eb6..6e8c38e5 100644 --- a/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp @@ -9,21 +9,21 @@ void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) { if (killer != nullptr) { - auto* destroyableComponent = killer->GetComponent(); + auto destroyableComponent = killer->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10); EntityManager::Instance()->SerializeEntity(killer); } // get possessor to progress statistics and tasks. - auto* possessableComponent = killer->GetComponent(); + auto possessableComponent = killer->GetComponent(); if (possessableComponent != nullptr) { auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); if (possessor != nullptr) { - auto* missionComponent = possessor->GetComponent(); - auto* characterComponent = possessor->GetComponent(); + auto missionComponent = possessor->GetComponent(); + auto characterComponent = possessor->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(ImaginationPowerUpsCollected); characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed); diff --git a/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp b/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp index 6a29f9a8..2b03b8e5 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp @@ -19,13 +19,13 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) { return; } - auto* skillComponent = killer->GetComponent(); + auto skillComponent = killer->GetComponent(); if (skillComponent == nullptr) { return; } - auto* destroyableComponent = killer->GetComponent(); + auto destroyableComponent = killer->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->SetImagination(60); @@ -34,14 +34,14 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) { } // Find possessor of race car to progress missions and update stats. - auto* possessableComponent = killer->GetComponent(); + auto possessableComponent = killer->GetComponent(); if (possessableComponent != nullptr) { auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); if (possessor != nullptr) { - auto* missionComponent = possessor->GetComponent(); - auto* characterComponent = possessor->GetComponent(); + auto missionComponent = possessor->GetComponent(); + auto characterComponent = possessor->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(RacingImaginationCratesSmashed); diff --git a/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp b/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp index 92a50873..fe0a1595 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp @@ -9,7 +9,7 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (sender->IsPlayer() && args == "powerup") { - auto* possessorComponent = sender->GetComponent(); + auto possessorComponent = sender->GetComponent(); if (possessorComponent == nullptr) { return; @@ -21,7 +21,7 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std return; } - auto* destroyableComponent = vehicle->GetComponent(); + auto destroyableComponent = vehicle->GetComponent(); if (destroyableComponent == nullptr) { return; @@ -29,7 +29,7 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std destroyableComponent->Imagine(10); - auto* missionComponent = sender->GetComponent(); + auto missionComponent = sender->GetComponent(); if (missionComponent == nullptr) return; missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::COLLECT_IMAGINATION); diff --git a/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp b/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp index 295f38ee..298bc1eb 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp @@ -8,14 +8,14 @@ void RaceSmashServer::OnDie(Entity* self, Entity* killer) { // Crate is smashed by the car - auto* possessableComponent = killer->GetComponent(); + auto possessableComponent = killer->GetComponent(); if (possessableComponent != nullptr) { auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); if (possessor != nullptr) { - auto* missionComponent = possessor->GetComponent(); - auto* characterComponent = possessor->GetComponent(); + auto missionComponent = possessor->GetComponent(); + auto characterComponent = possessor->GetComponent(); if (characterComponent != nullptr) { characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed); diff --git a/dScripts/client/ai/PR/CrabServer.cpp b/dScripts/client/ai/PR/CrabServer.cpp index f30142ba..6212f33c 100644 --- a/dScripts/client/ai/PR/CrabServer.cpp +++ b/dScripts/client/ai/PR/CrabServer.cpp @@ -3,7 +3,7 @@ #include "ePetTamingNotifyType.h" void CrabServer::OnStartup(Entity* self) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) return; @@ -20,7 +20,7 @@ void CrabServer::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "killself") { // Don't accidentally kill a pet that is already owned - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr || petComponent->GetOwner() != nullptr) return; @@ -34,7 +34,7 @@ void CrabServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTami } else if (type == ePetTamingNotifyType::QUIT || type == ePetTamingNotifyType::FAILED) { self->Smash(self->GetObjectID(), eKillType::SILENT); } else if (type == ePetTamingNotifyType::SUCCESS) { - auto* petComponent = self->GetComponent(); + auto petComponent = self->GetComponent(); if (petComponent == nullptr) return; // TODO: Remove custom group? diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 18625960..0fa658ad 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -685,7 +685,7 @@ void HandlePacket(Packet* packet) { } if (entity) { - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent != nullptr) { skillComponent->Reset(); @@ -1020,13 +1020,13 @@ void HandlePacket(Packet* packet) { EntityManager::Instance()->ConstructAllEntities(packet->systemAddress); - auto* characterComponent = player->GetComponent(); + auto characterComponent = player->GetComponent(); if (characterComponent) { player->GetComponent()->RocketUnEquip(player); } // Do charxml fixes here - auto* levelComponent = player->GetComponent(); + auto levelComponent = player->GetComponent(); if (!levelComponent) return; auto version = levelComponent->GetCharacterVersion(); @@ -1052,7 +1052,7 @@ void HandlePacket(Packet* packet) { player->GetCharacter()->SetTargetScene(""); // Fix the destroyable component - auto* destroyableComponent = player->GetComponent(); + auto destroyableComponent = player->GetComponent(); if (destroyableComponent != nullptr) { destroyableComponent->FixStats(); @@ -1281,7 +1281,7 @@ void WorldShutdownProcess(uint32_t zoneId) { auto* entity = Player::GetPlayer(player); Game::logger->Log("WorldServer", "Saving data!"); if (entity != nullptr && entity->GetCharacter() != nullptr) { - auto* skillComponent = entity->GetComponent(); + auto skillComponent = entity->GetComponent(); if (skillComponent != nullptr) { skillComponent->Reset(); diff --git a/tests/dGameTests/dComponentsTests/DestroyableComponentTests.cpp b/tests/dGameTests/dComponentsTests/DestroyableComponentTests.cpp index db9c033a..558051d3 100644 --- a/tests/dGameTests/dComponentsTests/DestroyableComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/DestroyableComponentTests.cpp @@ -2,8 +2,8 @@ #include #include "BitStream.h" -#include "DestroyableComponent.h" #include "Entity.h" +#include "DestroyableComponent.h" #include "eReplicaComponentType.h" #include "eStateChangeType.h" @@ -17,7 +17,7 @@ protected: SetUpDependencies(); baseEntity = new Entity(15, GameDependenciesTest::info); destroyableComponent = new DestroyableComponent(baseEntity); - baseEntity->AddComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent); + baseEntity->AddComponent(); // Initialize some values to be not default destroyableComponent->SetMaxHealth(12345.0f); destroyableComponent->SetHealth(23); @@ -319,7 +319,7 @@ TEST_F(DestroyableTest, DestroyableComponentFactionTest) { TEST_F(DestroyableTest, DestroyableComponentValiditiyTest) { auto* enemyEntity = new Entity(19, info); auto* enemyDestroyableComponent = new DestroyableComponent(enemyEntity); - enemyEntity->AddComponent(eReplicaComponentType::DESTROYABLE, enemyDestroyableComponent); + enemyEntity->AddComponent(); enemyDestroyableComponent->AddFactionNoLookup(16); destroyableComponent->AddEnemyFaction(16); EXPECT_TRUE(destroyableComponent->IsEnemy(enemyEntity));