summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Skeleton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Skeleton.cpp')
-rw-r--r--src/Mobs/Skeleton.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 7697f1279..01a4c54fb 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -57,17 +57,11 @@ bool cSkeleton::Attack(std::chrono::milliseconds a_Dt)
Vector3d Inaccuracy = Vector3d(Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25);
Vector3d Speed = (GetTarget()->GetPosition() + Inaccuracy - GetPosition()) * 5;
Speed.y = Speed.y - 1 + Random.NextInt(3);
- cArrowEntity * Arrow = new cArrowEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
- if (Arrow == nullptr)
+ auto Arrow = cpp14::make_unique<cArrowEntity>(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
+ if (!Arrow->Initialize(std::move(Arrow), *m_World))
{
return false;
}
- if (!Arrow->Initialize(*m_World))
- {
- delete Arrow;
- Arrow = nullptr;
- return false;
- }
ResetAttackCooldown();
return true;