From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- Minecraft.World/EnchantmentMenu.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Minecraft.World/EnchantmentMenu.cpp') diff --git a/Minecraft.World/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index f37f336e..fa769bf9 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -9,7 +9,7 @@ EnchantmentMenu::EnchantmentMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt) { - enchantSlots = std::make_shared(this); + enchantSlots = shared_ptr( new EnchantmentContainer(this) ); for(int i = 0; i < 3; ++i) { @@ -53,7 +53,7 @@ void EnchantmentMenu::broadcastChanges() // 4J Added m_costsChanged to stop continually sending update packets even when no changes have been made if(m_costsChanged) { - for (size_t i = 0; i < containerListeners.size(); i++) + for (int i = 0; i < containerListeners.size(); i++) { ContainerListener *listener = containerListeners.at(i); listener->setContainerData(this, 0, costs[0]); @@ -81,7 +81,7 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr { shared_ptr item = enchantSlots->getItem(0); - if (item == nullptr || !item->isEnchantable()) + if (item == NULL || !item->isEnchantable()) { for (int i = 0; i < 3; i++) { @@ -153,14 +153,14 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) { shared_ptr item = enchantSlots->getItem(0); - if (costs[i] > 0 && item != nullptr && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) + if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) { if (!level->isClientSide) { bool isBook = item->id == Item::book_Id; vector *newEnchantment = EnchantmentHelper::selectEnchantment(&random, item, costs[i]); - if (newEnchantment != nullptr) + if (newEnchantment != NULL) { player->giveExperienceLevels(-costs[i]); if (isBook) item->id = Item::enchantedBook_Id; @@ -200,7 +200,7 @@ void EnchantmentMenu::removed(shared_ptr player) if (level->isClientSide) return; shared_ptr item = enchantSlots->removeItemNoUpdate(0); - if (item != nullptr) + if (item != NULL) { player->drop(item); } @@ -219,7 +219,7 @@ shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr play Slot *slot = slots.at(slotIndex); Slot *IngredientSlot = slots.at(INGREDIENT_SLOT); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); -- cgit v1.2.3