diff options
Diffstat (limited to 'src/Items')
-rw-r--r-- | src/Items/ItemBoat.h | 7 | ||||
-rw-r--r-- | src/Items/ItemFishingRod.h | 7 | ||||
-rw-r--r-- | src/Items/ItemMinecart.h | 7 | ||||
-rw-r--r-- | src/Items/ItemPainting.h | 7 |
4 files changed, 24 insertions, 4 deletions
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h index be1663eef..ced5ec3a8 100644 --- a/src/Items/ItemBoat.h +++ b/src/Items/ItemBoat.h @@ -96,7 +96,12 @@ public: // Spawn block at water level cBoat * Boat = new cBoat(x + 0.5, y + 0.5, z + 0.5); - Boat->Initialize(*a_World); + if (!Boat->Initialize(*a_World)) + { + delete Boat; + Boat = nullptr; + return false; + } // Remove boat from players hand if (!a_Player->IsGameModeCreative()) diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index fa27e08f6..3958b12e5 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -251,7 +251,12 @@ public: else { cFloater * Floater = new cFloater(a_Player->GetPosX(), a_Player->GetStance(), a_Player->GetPosZ(), a_Player->GetLookVector() * 15, a_Player->GetUniqueID(), static_cast<int>(100 + static_cast<unsigned int>(a_World->GetTickRandomNumber(800)) - (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchLure) * 100))); - Floater->Initialize(*a_World); + if (!Floater->Initialize(*a_World)) + { + delete Floater; + Floater = nullptr; + return false; + } a_Player->SetIsFishing(true, Floater->GetUniqueID()); } return true; diff --git a/src/Items/ItemMinecart.h b/src/Items/ItemMinecart.h index 6344c0178..623342d41 100644 --- a/src/Items/ItemMinecart.h +++ b/src/Items/ItemMinecart.h @@ -73,7 +73,12 @@ public: return false; } } // switch (m_ItemType) - Minecart->Initialize(*a_World); + if (!Minecart->Initialize(*a_World)) + { + delete Minecart; + Minecart = nullptr; + return false; + } if (!a_Player->IsGameModeCreative()) { diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h index dd35931dd..3432583ca 100644 --- a/src/Items/ItemPainting.h +++ b/src/Items/ItemPainting.h @@ -71,7 +71,12 @@ public: }; cPainting * Painting = new cPainting(gPaintingTitlesList[a_World->GetTickRandomNumber(ARRAYCOUNT(gPaintingTitlesList) - 1)].Title, a_BlockFace, a_BlockX, a_BlockY, a_BlockZ); - Painting->Initialize(*a_World); + if (!Painting->Initialize(*a_World)) + { + delete Painting; + Painting = nullptr; + return false; + } if (!a_Player->IsGameModeCreative()) { |