summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemFishingRod.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2016-12-19 21:12:23 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-07 20:24:16 +0200
commit4ef47aed62364f9cf1474864e5cf94232b4477af (patch)
tree28ca15247c2437b91e9aada48c2da4a1a3c00c17 /src/Items/ItemFishingRod.h
parentRemoved unneeded includes (#3902) (diff)
downloadcuberite-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/ItemFishingRod.h')
-rw-r--r--src/Items/ItemFishingRod.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h
index a32368304..012f13a6c 100644
--- a/src/Items/ItemFishingRod.h
+++ b/src/Items/ItemFishingRod.h
@@ -251,14 +251,13 @@ public:
}
else
{
- cFloater * Floater = new cFloater(a_Player->GetPosX(), a_Player->GetStance(), a_Player->GetPosZ(), a_Player->GetLookVector() * 15, a_Player->GetUniqueID(), (Random.RandInt(100, 900) - static_cast<int>(a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchLure) * 100)));
- if (!Floater->Initialize(*a_World))
+ auto Floater = cpp14::make_unique<cFloater>(a_Player->GetPosX(), a_Player->GetStance(), a_Player->GetPosZ(), a_Player->GetLookVector() * 15, a_Player->GetUniqueID(), (Random.RandInt(100, 900) - static_cast<int>(a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchLure) * 100)));
+ auto FloaterPtr = Floater.get();
+ if (!FloaterPtr->Initialize(std::move(Floater), *a_World))
{
- delete Floater;
- Floater = nullptr;
return false;
}
- a_Player->SetIsFishing(true, Floater->GetUniqueID());
+ a_Player->SetIsFishing(true, FloaterPtr->GetUniqueID());
}
return true;
}