From b5b119ca750a1790848b514bb00831b050f25fac Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 18 Dec 2016 20:41:37 +0000 Subject: good --- src/Mobs/Skeleton.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Mobs/Skeleton.cpp') 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(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; -- cgit v1.2.3