summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Blaze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Blaze.cpp')
-rw-r--r--src/Mobs/Blaze.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index 8cdac12d1..a48bfa886 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -39,19 +39,17 @@ bool cBlaze::Attack(std::chrono::milliseconds a_Dt)
// Setting this higher gives us more wiggle room for attackrate
Vector3d Speed = GetLookVector() * 20;
Speed.y = Speed.y + 1;
- cFireChargeEntity * FireCharge = new cFireChargeEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
- if (FireCharge == nullptr)
- {
- return false;
- }
- if (!FireCharge->Initialize(*m_World))
+
+ auto FireCharge = cpp14::make_unique<cFireChargeEntity>(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
+ auto FireChargePtr = FireCharge.get();
+ if (!FireChargePtr->Initialize(std::move(FireCharge), *m_World))
{
- delete FireCharge;
- FireCharge = nullptr;
return false;
}
+
ResetAttackCooldown();
// ToDo: Shoot 3 fireballs instead of 1.
+
return true;
}
return false;