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

@@ -3,6 +3,6 @@
#include "SkillComponent.h"
void GfArchway::OnRebuildComplete(Entity* self, Entity* target) {
auto* skillComponent = target->GetComponent<SkillComponent>();
auto skillComponent = target->GetComponent<SkillComponent>();
if (skillComponent) skillComponent->CalculateBehavior(SHIELDING_SKILL, SHIELDING_BEHAVIOR, target->GetObjectID(), true);
}

View File

@@ -38,7 +38,7 @@ void GfBanana::OnStartup(Entity* self) {
}
void GfBanana::OnHit(Entity* self, Entity* attacker) {
auto* destroyable = self->GetComponent<DestroyableComponent>();
auto destroyable = self->GetComponent<DestroyableComponent>();
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<DestroyableComponent>();
auto bananaDestroyable = bananaEntity->GetComponent<DestroyableComponent>();
bananaDestroyable->SetHealth(0);

View File

@@ -11,7 +11,7 @@ void GfCampfire::OnStartup(Entity* self) {
self->SetProximityRadius(2.0f, "placeholder");
self->SetBoolean(u"isBurning", true);
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
auto render = self->GetComponent<RenderComponent>();
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<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
auto render = self->GetComponent<RenderComponent>();
render->PlayEffect(295, u"running", "Burn");
}
}
void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
auto* skill = self->GetComponent<SkillComponent>();
auto skill = self->GetComponent<SkillComponent>();
if (self->GetBoolean(u"isBurning")) {
if (status == "ENTER") {
@@ -43,7 +43,7 @@ void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string n
//self->SetVar<LWOOBJID>("target", entering->GetObjectID());
auto* missionComponet = entering->GetComponent<MissionComponent>();
auto missionComponet = entering->GetComponent<MissionComponent>();
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<bool>(u"isBurning")) {
auto* renderComponent = self->GetComponent<RenderComponent>();
auto renderComponent = self->GetComponent<RenderComponent>();
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<bool>(u"isBurning")) {
auto* renderComponent = self->GetComponent<RenderComponent>();
auto renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr) {
renderComponent->StopEffect("Off");
renderComponent->PlayEffect(295, u"running", "Burn");

View File

@@ -4,7 +4,7 @@
#include "eMissionState.h"
void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* missionComponent = target->GetComponent<MissionComponent>();
auto missionComponent = target->GetComponent<MissionComponent>();
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<MissionComponent>();
auto missionComponent = user->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;

View File

@@ -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<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true);
}
if (timerName == m_KillSelfTimerName) {

View File

@@ -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<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (args == "Slow") {
skillComponent->CalculateBehavior(m_SlowSkillID, m_SlowBehaviorID, sender->GetObjectID());
} else if (args == "Unslow") {

View File

@@ -22,7 +22,7 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
info.lot = 7410; // Normal GF treasure
info.settings.push_back(new LDFData<std::u16string>(u"groupID", u"Flag" + flagNumber));
} else {
auto* missionComponent = target->GetComponent<MissionComponent>();
auto missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(746) == eMissionState::ACTIVE) {
info.lot = 9307; // Special Captain Jack treasure that drops a mission item
} else {