From a9be52c41a02d207233199e98898fe7483d7e817 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:56:03 -0500 Subject: Project modernization (#630) * Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides --- Minecraft.World/FlowerPotTile.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Minecraft.World/FlowerPotTile.cpp') diff --git a/Minecraft.World/FlowerPotTile.cpp b/Minecraft.World/FlowerPotTile.cpp index 4cdd529c..80fdf2e4 100644 --- a/Minecraft.World/FlowerPotTile.cpp +++ b/Minecraft.World/FlowerPotTile.cpp @@ -36,7 +36,7 @@ bool FlowerPotTile::isCubeShaped() bool FlowerPotTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { shared_ptr item = player->inventory->getSelected(); - if (item == NULL) return false; + if (item == nullptr) return false; if (level->getData(x, y, z) != 0) return false; int type = getTypeFromItem(item); @@ -62,7 +62,7 @@ int FlowerPotTile::cloneTileId(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == NULL) + if (item == nullptr) { return Item::flowerPot_Id; } @@ -76,7 +76,7 @@ int FlowerPotTile::cloneTileData(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == NULL) + if (item == nullptr) { return Item::flowerPot_Id; } @@ -113,7 +113,7 @@ void FlowerPotTile::spawnResources(Level *level, int x, int y, int z, int data, if (data > 0) { shared_ptr item = getItemFromType(data); - if (item != NULL) popResource(level, x, y, z, item); + if (item != nullptr) popResource(level, x, y, z, item); } } @@ -127,27 +127,27 @@ shared_ptr FlowerPotTile::getItemFromType(int type) switch (type) { case TYPE_FLOWER_RED: - return shared_ptr( new ItemInstance(Tile::rose) ); + return std::make_shared(Tile::rose); case TYPE_FLOWER_YELLOW: - return shared_ptr( new ItemInstance(Tile::flower) ); + return std::make_shared(Tile::flower); case TYPE_CACTUS: - return shared_ptr( new ItemInstance(Tile::cactus) ); + return std::make_shared(Tile::cactus); case TYPE_MUSHROOM_BROWN: - return shared_ptr( new ItemInstance(Tile::mushroom_brown) ); + return std::make_shared(Tile::mushroom_brown); case TYPE_MUSHROOM_RED: - return shared_ptr( new ItemInstance(Tile::mushroom_red) ); + return std::make_shared(Tile::mushroom_red); case TYPE_DEAD_BUSH: - return shared_ptr( new ItemInstance(Tile::deadBush) ); + return std::make_shared(Tile::deadBush); case TYPE_SAPLING_DEFAULT: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_DEFAULT) ); + return std::make_shared(Tile::sapling, 1, Sapling::TYPE_DEFAULT); case TYPE_SAPLING_BIRCH: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_BIRCH) ); + return std::make_shared(Tile::sapling, 1, Sapling::TYPE_BIRCH); case TYPE_SAPLING_EVERGREEN: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_EVERGREEN) ); + return std::make_shared(Tile::sapling, 1, Sapling::TYPE_EVERGREEN); case TYPE_SAPLING_JUNGLE: - return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_JUNGLE) ); + return std::make_shared(Tile::sapling, 1, Sapling::TYPE_JUNGLE); case TYPE_FERN: - return shared_ptr( new ItemInstance(Tile::tallgrass, 1, TallGrass::FERN) ); + return std::make_shared(Tile::tallgrass, 1, TallGrass::FERN); } return nullptr; -- cgit v1.2.3