diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-12-18 21:41:37 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-12-18 21:41:37 +0100 |
commit | b5b119ca750a1790848b514bb00831b050f25fac (patch) | |
tree | e7a145a856676d248da5050b57da1cee4d005815 /src/Mobs/Skeleton.cpp | |
parent | test (diff) | |
download | cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar.gz cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar.bz2 cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar.lz cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar.xz cuberite-b5b119ca750a1790848b514bb00831b050f25fac.tar.zst cuberite-b5b119ca750a1790848b514bb00831b050f25fac.zip |
Diffstat (limited to 'src/Mobs/Skeleton.cpp')
-rw-r--r-- | src/Mobs/Skeleton.cpp | 10 |
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; |