mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-03 04:44:29 +00:00
refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
This commit is contained in:
@@ -11,7 +11,7 @@ MerchantContainer::MerchantContainer(std::shared_ptr<Player> player,
|
||||
items[0] = nullptr;
|
||||
items[1] = nullptr;
|
||||
items[2] = nullptr;
|
||||
activeRecipe = NULL;
|
||||
activeRecipe = nullptr;
|
||||
selectionHint = 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ std::shared_ptr<ItemInstance> MerchantContainer::getItem(unsigned int slot) {
|
||||
|
||||
std::shared_ptr<ItemInstance> MerchantContainer::removeItem(unsigned int slot,
|
||||
int count) {
|
||||
if (items[slot] != NULL) {
|
||||
if (items[slot] != nullptr) {
|
||||
if (slot == MerchantMenu::RESULT_SLOT) {
|
||||
std::shared_ptr<ItemInstance> item = items[slot];
|
||||
items[slot] = nullptr;
|
||||
@@ -56,7 +56,7 @@ bool MerchantContainer::isPaymentSlot(int slot) {
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> MerchantContainer::removeItemNoUpdate(int slot) {
|
||||
if (items[slot] != NULL) {
|
||||
if (items[slot] != nullptr) {
|
||||
std::shared_ptr<ItemInstance> item = items[slot];
|
||||
items[slot] = nullptr;
|
||||
return item;
|
||||
@@ -67,7 +67,7 @@ std::shared_ptr<ItemInstance> MerchantContainer::removeItemNoUpdate(int slot) {
|
||||
void MerchantContainer::setItem(unsigned int slot,
|
||||
std::shared_ptr<ItemInstance> item) {
|
||||
items[slot] = item;
|
||||
if (item != NULL && item->count > getMaxStackSize())
|
||||
if (item != nullptr && item->count > getMaxStackSize())
|
||||
item->count = getMaxStackSize();
|
||||
if (isPaymentSlot(slot)) {
|
||||
updateSellItem();
|
||||
@@ -100,32 +100,32 @@ bool MerchantContainer::canPlaceItem(int slot,
|
||||
void MerchantContainer::setChanged() { updateSellItem(); }
|
||||
|
||||
void MerchantContainer::updateSellItem() {
|
||||
activeRecipe = NULL;
|
||||
activeRecipe = nullptr;
|
||||
|
||||
std::shared_ptr<ItemInstance> buyItem1 = items[MerchantMenu::PAYMENT1_SLOT];
|
||||
std::shared_ptr<ItemInstance> buyItem2 = items[MerchantMenu::PAYMENT2_SLOT];
|
||||
|
||||
if (buyItem1 == NULL) {
|
||||
if (buyItem1 == nullptr) {
|
||||
buyItem1 = buyItem2;
|
||||
buyItem2 = nullptr;
|
||||
}
|
||||
|
||||
if (buyItem1 == NULL) {
|
||||
if (buyItem1 == nullptr) {
|
||||
setItem(MerchantMenu::RESULT_SLOT, nullptr);
|
||||
} else {
|
||||
MerchantRecipeList* offers = merchant->getOffers(player);
|
||||
if (offers != NULL) {
|
||||
if (offers != nullptr) {
|
||||
MerchantRecipe* recipeFor =
|
||||
offers->getRecipeFor(buyItem1, buyItem2, selectionHint);
|
||||
if (recipeFor != NULL && !recipeFor->isDeprecated()) {
|
||||
if (recipeFor != nullptr && !recipeFor->isDeprecated()) {
|
||||
activeRecipe = recipeFor;
|
||||
setItem(MerchantMenu::RESULT_SLOT,
|
||||
recipeFor->getSellItem()->copy());
|
||||
} else if (buyItem2 != NULL) {
|
||||
} else if (buyItem2 != nullptr) {
|
||||
// try to switch
|
||||
recipeFor =
|
||||
offers->getRecipeFor(buyItem2, buyItem1, selectionHint);
|
||||
if (recipeFor != NULL && !recipeFor->isDeprecated()) {
|
||||
if (recipeFor != nullptr && !recipeFor->isDeprecated()) {
|
||||
activeRecipe = recipeFor;
|
||||
setItem(MerchantMenu::RESULT_SLOT,
|
||||
recipeFor->getSellItem()->copy());
|
||||
|
||||
Reference in New Issue
Block a user