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/Items/ItemBow.h | |
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/Items/ItemBow.h')
-rw-r--r-- | src/Items/ItemBow.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h index a2f646efc..7cbd1dc70 100644 --- a/src/Items/ItemBow.h +++ b/src/Items/ItemBow.h @@ -69,17 +69,12 @@ public: } // Create the arrow entity: - cArrowEntity * Arrow = new cArrowEntity(*a_Player, Force * 2); - if (Arrow == nullptr) + auto Arrow = cpp14::make_unique<cArrowEntity>(*a_Player, Force * 2); + auto ArrowPtr = Arrow.get(); + if (!ArrowPtr->Initialize(std::move(Arrow), *a_Player->GetWorld())) { return; } - if (!Arrow->Initialize(*a_Player->GetWorld())) - { - delete Arrow; - Arrow = nullptr; - return; - } a_Player->GetWorld()->BroadcastSoundEffect( "entity.arrow.shoot", a_Player->GetPosX(), |