diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-12-19 21:12:23 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2017-08-07 20:24:16 +0200 |
commit | 4ef47aed62364f9cf1474864e5cf94232b4477af (patch) | |
tree | 28ca15247c2437b91e9aada48c2da4a1a3c00c17 /src/Mobs/Blaze.cpp | |
parent | Removed unneeded includes (#3902) (diff) | |
download | cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.gz cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.bz2 cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.lz cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.xz cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.zst cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.zip |
Diffstat (limited to 'src/Mobs/Blaze.cpp')
-rw-r--r-- | src/Mobs/Blaze.cpp | 14 |
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; |