diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-08-20 14:34:29 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-08-20 14:34:29 +0200 |
commit | 7175b9e435a54cff33914d21384625a445cc5cf0 (patch) | |
tree | 7feb44f1e8e4ed7ea4d5bf0ba1d173abd3417f34 /src/Mobs/Ghast.cpp | |
parent | Added cWorld:SetSpawn() API and Lua binding (#3316) (diff) | |
download | cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar.gz cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar.bz2 cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar.lz cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar.xz cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.tar.zst cuberite-7175b9e435a54cff33914d21384625a445cc5cf0.zip |
Diffstat (limited to 'src/Mobs/Ghast.cpp')
-rw-r--r-- | src/Mobs/Ghast.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index 0544255df..d40545b1d 100644 --- a/src/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp @@ -39,17 +39,11 @@ bool cGhast::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; - cGhastFireballEntity * GhastBall = new cGhastFireballEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); - if (GhastBall == nullptr) + auto GhastBall = cpp14::make_unique<cGhastFireballEntity>(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); + if (!GhastBall->Initialize(std::move(GhastBall), *m_World)) { return false; } - if (!GhastBall->Initialize(*m_World)) - { - delete GhastBall; - GhastBall = nullptr; - return false; - } ResetAttackCooldown(); return true; } |