Move to shared pointer

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

View File

@@ -189,10 +189,11 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
m_StartPosition = m_OwningEntity->GetPosition();
}
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
if (m_MovementAI == nullptr) {
return;
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
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<RebuildComponent>();
auto rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
if (rebuild != nullptr) {
const auto state = rebuild->GetState();
@@ -253,7 +254,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
}
}
auto* skillComponent = m_OwningEntity->GetComponent<SkillComponent>();
auto skillComponent = m_OwningEntity->GetComponent<SkillComponent>();
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<DestroyableComponent>();
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
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<DestroyableComponent>();
auto destroyable = entity->GetComponent<DestroyableComponent>();
if (destroyable == nullptr) {
return false;
}
auto* referenceDestroyable = m_OwningEntity->GetComponent<DestroyableComponent>();
auto referenceDestroyable = m_OwningEntity->GetComponent<DestroyableComponent>();
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<RebuildComponent>();
auto quickbuild = entity->GetComponent<RebuildComponent>();
if (quickbuild != nullptr) {
const auto state = quickbuild->GetState();

View File

@@ -10,6 +10,7 @@
#include "Component.h"
#include "eReplicaComponentType.h"
#include <memory>
#include <vector>
#include <map>
@@ -319,7 +320,7 @@ private:
/**
* The component that handles movement AI, also owned by this entity
*/
MovementAIComponent* m_MovementAI;
std::shared_ptr<MovementAIComponent> m_MovementAI;
/**
* The position at which this entity spawned

View File

@@ -71,7 +71,7 @@ void BouncerComponent::LookupPetSwitch() {
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group);
for (auto* entity : entities) {
auto* switchComponent = entity->GetComponent<SwitchComponent>();
auto switchComponent = entity->GetComponent<SwitchComponent>();
if (switchComponent != nullptr) {
switchComponent->SetPetBouncer(this);

View File

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

View File

@@ -27,7 +27,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
}
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
auto inventoryComponent = originator->GetComponent<InventoryComponent>();
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<InventoryComponent>();
auto inv = m_OwningEntity->GetComponent<InventoryComponent>();
if (!inv) return;
inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here
}

View File

@@ -367,7 +367,7 @@ void CharacterComponent::SetLastRocketConfig(std::u16string config) {
Item* CharacterComponent::GetRocket(Entity* player) {
Item* rocket = nullptr;
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
auto inventoryComponent = player->GetComponent<InventoryComponent>();
if (!inventoryComponent) return rocket;

View File

@@ -38,6 +38,6 @@ void Component::LoadTemplateData() {
}
void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction = false) {
void Component::Serialize(RakNet::BitStream* bitStream, bool isConstruction) {
}

View File

@@ -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<LevelProgressionComponent>();
auto levelProgressionComponent = m_OwningEntity->GetComponent<LevelProgressionComponent>();
if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase();
} else { // Used the last applied speedboost
m_SpeedBoost = m_ActiveSpeedBoosts.back();

View File

@@ -185,7 +185,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
return;
}
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
auto buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
if (buffComponent != nullptr) {
buffComponent->LoadFromXml(doc);
@@ -207,7 +207,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
return;
}
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
auto buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
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<CharacterComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
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<CharacterComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->TrackArmorDelta(value - m_iArmor);
}
m_iArmor = value;
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
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<CharacterComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->TrackImaginationDelta(value - m_iImagination);
}
m_iImagination = value;
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
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<DestroyableComponent>();
const auto otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
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<DestroyableComponent>();
const auto otherDestroyableComponent = other->GetComponent<DestroyableComponent>();
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<CharacterComponent>();
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
auto inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
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<DestroyableComponent>();
auto targetDestroyable = targetEntity->GetComponent<DestroyableComponent>();
if (targetDestroyable == nullptr) {
return false;
}
auto* targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
auto targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
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<BaseCombatAIComponent>();
auto combatComponent = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
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<BaseCombatAIComponent>() != nullptr;
auto* inventoryComponent = owner->GetComponent<InventoryComponent>();
auto inventoryComponent = owner->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr && isEnemy) {
inventoryComponent->TriggerPassiveAbility(PassiveAbilityTrigger::EnemySmashed, m_OwningEntity);
}
auto* missions = owner->GetComponent<MissionComponent>();
auto missions = owner->GetComponent<MissionComponent>();
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<MissionComponent>();
auto memberMissions = member->GetComponent<MissionComponent>();
if (memberMissions == nullptr) continue;
@@ -750,7 +750,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
if (team != nullptr && m_OwningEntity->GetComponent<BaseCombatAIComponent>() != nullptr) {
LWOOBJID specificOwner = LWOOBJID_EMPTY;
auto* scriptedActivityComponent = m_OwningEntity->GetComponent<ScriptedActivityComponent>();
auto scriptedActivityComponent = m_OwningEntity->GetComponent<ScriptedActivityComponent>();
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<SkillComponent>();
auto* buffComponent = entity->GetComponent<BuffComponent>();
auto* missionComponent = entity->GetComponent<MissionComponent>();
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
auto skillComponent = entity->GetComponent<SkillComponent>();
auto buffComponent = entity->GetComponent<BuffComponent>();
auto missionComponent = entity->GetComponent<MissionComponent>();
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
// 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<CharacterComponent>();
auto character = m_OwningEntity->GetComponent<CharacterComponent>();
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<InventoryComponent>();
auto inventory = m_OwningEntity->GetComponent<InventoryComponent>();
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<CharacterComponent>();
auto playerStats = player->GetComponent<CharacterComponent>();
if (playerStats) {
//get the maximum health from this enemy:
auto maxHealth = GetMaxHealth();

View File

@@ -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;

View File

@@ -189,7 +189,7 @@ void InventoryComponent::AddItem(
inventoryType = Inventory::FindInventoryTypeForLot(lot);
}
auto* missions = static_cast<MissionComponent*>(this->m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
auto missions = m_OwningEntity->GetComponent<MissionComponent>();
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<MissionComponent>();
auto missionComponent = m_OwningEntity->GetComponent<MissionComponent>();
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<CharacterComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
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<CharacterComponent>();
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
if (!characterComponent) return;
auto* possessorComponent = m_OwningEntity->GetComponent<PossessorComponent>();
auto possessorComponent = m_OwningEntity->GetComponent<PossessorComponent>();
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<VehiclePhysicsComponent>();
auto vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>();
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<DestroyableComponent>();
auto destroyableComponent = mount->GetComponent<DestroyableComponent>();
if (destroyableComponent) {
destroyableComponent->SetIsSmashable(false);
destroyableComponent->SetIsImmune(true);
}
// Mount it
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
auto possessableComponent = mount->GetComponent<PossessableComponent>();
if (possessableComponent) {
possessableComponent->SetIsItemSpawned(true);
possessableComponent->SetPossessor(m_OwningEntity->GetObjectID());
@@ -1227,7 +1227,7 @@ bool InventoryComponent::HasAnyPassive(const std::vector<eItemSetPassiveAbilityI
}
void InventoryComponent::DespawnPet() {
auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
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<PetComponent>();
auto petComponent = pet->GetComponent<PetComponent>();
if (petComponent != nullptr) {
petComponent->Activate(item);
@@ -1339,7 +1339,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
return entry.objectTemplate == static_cast<unsigned int>(item->GetLot());
});
auto* missions = static_cast<MissionComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
auto missions = m_OwningEntity->GetComponent<MissionComponent>();
for (const auto& result : results) {
if (result.castOnType == 1) {

View File

@@ -49,8 +49,8 @@ void LevelProgressionComponent::HandleLevelUp() {
const auto& rewards = rewardsTable->GetByLevelID(m_Level);
bool rewardingItem = rewards.size() > 0;
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
auto inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
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<ControllablePhysicsComponent>();
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent) controllablePhysicsComponent->SetSpeedMultiplier(m_SpeedBase / 500.0f);
}

View File

@@ -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<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
auto missionComponent = entity->GetComponent<MissionComponent>();
if (!missionComponent) {
Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu", entity->GetObjectID());

View File

@@ -22,7 +22,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) :
m_BaseCombatAI = nullptr;
m_BaseCombatAI = reinterpret_cast<BaseCombatAIComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
m_BaseCombatAI = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
//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<ControllablePhysicsComponent>();
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent != nullptr) {
controllablePhysicsComponent->SetPosition(value);
@@ -330,7 +330,7 @@ void MovementAIComponent::SetPosition(const NiPoint3& value) {
return;
}
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
if (simplePhysicsComponent != nullptr) {
simplePhysicsComponent->SetPosition(value);
@@ -342,7 +342,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
return;
}
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent != nullptr) {
controllablePhysicsComponent->SetRotation(value);
@@ -350,7 +350,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
return;
}
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
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<ControllablePhysicsComponent>();
auto controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent != nullptr) {
controllablePhysicsComponent->SetVelocity(value);
@@ -366,7 +366,7 @@ void MovementAIComponent::SetVelocity(const NiPoint3& value) {
return;
}
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
auto simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
if (simplePhysicsComponent != nullptr) {
simplePhysicsComponent->SetVelocity(value);

View File

@@ -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<BaseCombatAIComponent> m_BaseCombatAI = nullptr;
/**
* The path the entity is currently following

View File

@@ -163,7 +163,7 @@ void PetComponent::OnUse(Entity* originator) {
m_Tamer = LWOOBJID_EMPTY;
}
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
auto inventoryComponent = originator->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
return;
@@ -173,7 +173,7 @@ void PetComponent::OnUse(Entity* originator) {
return;
}
auto* movementAIComponent = m_OwningEntity->GetComponent<MovementAIComponent>();
auto movementAIComponent = m_OwningEntity->GetComponent<MovementAIComponent>();
if (movementAIComponent != nullptr) {
movementAIComponent->Stop();
@@ -224,7 +224,7 @@ void PetComponent::OnUse(Entity* originator) {
imaginationCost = cached->second.imaginationCost;
}
auto* destroyableComponent = originator->GetComponent<DestroyableComponent>();
auto destroyableComponent = originator->GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr) {
return;
@@ -362,10 +362,9 @@ void PetComponent::Update(float deltaTime) {
return;
}
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
if (m_MovementAI == nullptr) {
return;
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
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<DestroyableComponent>();
auto destroyableComponent = tamer->GetComponent<DestroyableComponent>();
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<InventoryComponent>();
auto inventoryComponent = tamer->GetComponent<InventoryComponent>();
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<MissionComponent>();
auto missionComponent = tamer->GetComponent<MissionComponent>();
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<CharacterComponent>();
auto characterComponent = tamer->GetComponent<CharacterComponent>();
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<InventoryComponent>();
auto inventoryComponent = tamer->GetComponent<InventoryComponent>();
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<InventoryComponent>();
auto inventoryComponent = GetOwner()->GetComponent<InventoryComponent>();
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> 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* PetComponent::GetActivePet(LWOOBJID owner) {
std::shared_ptr<PetComponent> PetComponent::GetActivePet(LWOOBJID owner) {
const auto& pair = activePets.find(owner);
if (pair == activePets.end()) {

View File

@@ -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<PetComponent> 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<PetComponent> 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<MovementAIComponent> m_MovementAI;
/**
* Preconditions that need to be met before an entity can tame this pet

View File

@@ -48,7 +48,7 @@ void PossessableComponent::Dismount() {
}
void PossessableComponent::OnUse(Entity* originator) {
auto* possessor = originator->GetComponent<PossessorComponent>();
auto possessor = originator->GetComponent<PossessorComponent>();
if (possessor) {
possessor->Mount(m_OwningEntity);
}

View File

@@ -15,7 +15,7 @@ PossessorComponent::~PossessorComponent() {
if (m_Possessable != LWOOBJID_EMPTY) {
auto* mount = EntityManager::Instance()->GetEntity(m_Possessable);
if (mount) {
auto* possessable = mount->GetComponent<PossessableComponent>();
auto possessable = mount->GetComponent<PossessableComponent>();
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<PossessableComponent>();
auto possessableComponent = mount->GetComponent<PossessableComponent>();
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<PossessableComponent>();
auto possessableComponent = mount->GetComponent<PossessableComponent>();
if (possessableComponent) {
possessableComponent->SetPossessor(LWOOBJID_EMPTY);
if (forceDismount) possessableComponent->ForceDepossess();

View File

@@ -26,10 +26,10 @@ PropertyEntranceComponent::PropertyEntranceComponent(uint32_t componentID, Entit
}
void PropertyEntranceComponent::OnUse(Entity* entity) {
auto* characterComponent = entity->GetComponent<CharacterComponent>();
auto characterComponent = entity->GetComponent<CharacterComponent>();
if (!characterComponent) return;
auto* rocket = entity->GetComponent<CharacterComponent>()->RocketEquip(entity);
auto rocket = entity->GetComponent<CharacterComponent>()->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<RocketLaunchpadControlComponent>();
auto launcher = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
if (launcher == nullptr) {
return;

View File

@@ -263,7 +263,7 @@ void PropertyManagementComponent::OnStartBuilding() {
SetPrivacyOption(PropertyPrivacyOption::Private); // Cant visit player which is building
if (!entrance.empty()) {
auto* rocketPad = entrance[0]->GetComponent<RocketLaunchpadControlComponent>();
auto rocketPad = entrance[0]->GetComponent<RocketLaunchpadControlComponent>();
if (rocketPad != nullptr) {
zoneId = rocketPad->GetDefaultZone();
@@ -302,7 +302,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
return;
}
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
return;
@@ -417,7 +417,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
return;
}
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
auto inventoryComponent = entity->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
return;

View File

@@ -87,7 +87,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
return;
}
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
auto inventoryComponent = player->GetComponent<InventoryComponent>();
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<DestroyableComponent>();
auto destroyableComponent = carEntity->GetComponent<DestroyableComponent>();
// 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<PossessableComponent>();
auto possessableComponent = carEntity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
possessableComponent->SetPossessor(player->GetObjectID());
}
// Load the vehicle's assemblyPartLOTs for display.
auto* moduleAssemblyComponent =
carEntity->GetComponent<ModuleAssemblyComponent>();
auto moduleAssemblyComponent = carEntity->GetComponent<ModuleAssemblyComponent>();
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<PossessorComponent>();
auto possessorComponent = player->GetComponent<PossessorComponent>();
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<CharacterComponent>();
auto characterComponent = player->GetComponent<CharacterComponent>();
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<DestroyableComponent>();
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
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<DestroyableComponent>();
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
// 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<CharacterComponent>();
auto characterComponent = player->GetComponent<CharacterComponent>();
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<MissionComponent>();
auto missionComponent = player->GetComponent<MissionComponent>();
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<DestroyableComponent>();
auto destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetImagination(0);
@@ -817,8 +813,7 @@ void RacingControlComponent::Update(float deltaTime) {
"Best lap time (%llu)", lapTime);
}
auto* missionComponent =
playerEntity->GetComponent<MissionComponent>();
auto missionComponent = playerEntity->GetComponent<MissionComponent>();
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<CharacterComponent>();
auto characterComponent = playerEntity->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->TrackRaceCompleted(m_Finished == 1);
}

View File

@@ -43,7 +43,7 @@ RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t component
RailActivatorComponent::~RailActivatorComponent() = default;
void RailActivatorComponent::OnUse(Entity* originator) {
auto* rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
auto rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
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<RebuildComponent>();
auto rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr) {
// Set back reset time

View File

@@ -194,7 +194,7 @@ void RebuildComponent::Update(float deltaTime) {
if (m_TimeBeforeDrain <= 0.0f) {
m_TimeBeforeDrain = m_CompleteTime / static_cast<float>(m_TakeImagination);
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
auto destComp = builder->GetComponent<DestroyableComponent>();
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<CharacterComponent>();
auto character = user->GetComponent<CharacterComponent>();
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<MovingPlatformComponent>();
auto movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
if (movingPlatform != nullptr) {
movingPlatform->OnRebuildInitilized();
}
@@ -434,7 +434,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
return;
}
auto* characterComponent = user->GetComponent<CharacterComponent>();
auto characterComponent = user->GetComponent<CharacterComponent>();
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<MissionComponent>();
auto missionComponent = member->GetComponent<MissionComponent>();
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
}
}
} else{
auto* missionComponent = builder->GetComponent<MissionComponent>();
auto missionComponent = builder->GetComponent<MissionComponent>();
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<MovingPlatformComponent>();
auto movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
if (movingPlatform != nullptr) {
movingPlatform->OnCompleteRebuild();
}
@@ -588,7 +588,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
return;
}
CharacterComponent* characterComponent = entity->GetComponent<CharacterComponent>();
auto characterComponent = entity->GetComponent<CharacterComponent>();
if (characterComponent) {
characterComponent->SetCurrentActivity(eGameActivity::NONE);
EntityManager::Instance()->SerializeEntity(entity);

View File

@@ -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<RenderComponent>();
auto renderComponent = self->GetComponent<RenderComponent>();
if (!renderComponent) return returnlength;
auto* animationsTable = CDClientManager::Instance().GetTable<CDAnimationsTable>();

View File

@@ -17,7 +17,7 @@ RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(p
RocketLaunchLupComponent::~RocketLaunchLupComponent() {}
void RocketLaunchLupComponent::OnUse(Entity* originator) {
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
auto rocket = originator->GetComponent<CharacterComponent>()->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<RocketLaunchpadControlComponent>();
auto rocketLaunchpadControlComponent = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
if (!rocketLaunchpadControlComponent) return;
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);

View File

@@ -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<CharacterComponent>();
auto characterComponent = originator->GetComponent<CharacterComponent>();
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<PropertyEntranceComponent>();
auto propertyEntrance = m_OwningEntity->GetComponent<PropertyEntranceComponent>();
if (propertyEntrance) {
return;
}
auto* rocketLaunchLUP = m_OwningEntity->GetComponent<RocketLaunchLupComponent>();
auto rocketLaunchLUP = m_OwningEntity->GetComponent<RocketLaunchLupComponent>();
if (rocketLaunchLUP) {
return;
}
// No rocket no launch
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
auto rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
if (!rocket) {
return;
}

View File

@@ -53,7 +53,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
}
}
auto* destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
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<MissionComponent>();
auto missionComponent = player->GetComponent<MissionComponent>();
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<InventoryComponent>();
auto inventoryComponent = player->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr)
return false;
@@ -555,7 +555,7 @@ void ActivityInstance::StartZone() {
}
void ActivityInstance::RewardParticipant(Entity* participant) {
auto* missionComponent = participant->GetComponent<MissionComponent>();
auto missionComponent = participant->GetComponent<MissionComponent>();
if (missionComponent) {
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID);
}

View File

@@ -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<BaseCombatAIComponent>();
auto combat = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
if (combat != nullptr && combat->GetStunImmune()) return;
for (const auto& behavior : this->m_managedBehaviors) {

View File

@@ -75,7 +75,7 @@ private:
/**
* Attached rebuild component.
*/
RebuildComponent* m_Rebuild;
std::shared_ptr<RebuildComponent> m_Rebuild;
/**
* If the switch is on or off.

View File

@@ -196,7 +196,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg
}
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
auto triggerComponent = targetEntity->GetComponent<TriggerComponent>();
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<RebuildComponent>();
auto rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
if (!rebuildComponent) {
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
return;
@@ -237,7 +237,7 @@ void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector<std:
void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::string> argArray){
if (argArray.size() < 3) return;
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
auto phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) {
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
return;
@@ -254,7 +254,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
auto phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) {
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
return;
@@ -334,7 +334,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vector<std
// If others need to be implemented for modding
// then we need a good way to convert this from a string to that enum
if (argArray.at(0) != "exploretask") return;
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
auto missionComponent = targetEntity->GetComponent<MissionComponent>();
if (!missionComponent){
Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!");
return;
@@ -353,7 +353,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vector<std::s
}
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
auto skillComponent = targetEntity->GetComponent<SkillComponent>();
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<std::string> argArray) {
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
auto phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
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<PhantomPhysicsComponent>();
auto phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) {
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
return;