mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-08-02 16:01:16 +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,9 +11,9 @@
|
||||
|
||||
|
||||
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() {
|
||||
m_menu = NULL;
|
||||
m_menu = nullptr;
|
||||
m_autoDeleteMenu = false;
|
||||
m_lastPointerLabelSlot = NULL;
|
||||
m_lastPointerLabelSlot = nullptr;
|
||||
|
||||
m_pointerPos.x = 0.0f;
|
||||
m_pointerPos.y = 0.0f;
|
||||
@@ -30,7 +30,7 @@ IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu() {
|
||||
void IUIScene_AbstractContainerMenu::Initialize(
|
||||
int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,
|
||||
ESceneSection firstSection, ESceneSection maxSection, bool bNavigateBack) {
|
||||
assert(menu != NULL);
|
||||
assert(menu != nullptr);
|
||||
|
||||
m_menu = menu;
|
||||
m_autoDeleteMenu = autoDeleteMenu;
|
||||
@@ -210,10 +210,10 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() {
|
||||
|
||||
void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[getPad()] != NULL) {
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
if (tutorial != NULL) {
|
||||
if (tutorial != nullptr) {
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
!tutorial->isInputAllowed(ACTION_MENU_UP)) {
|
||||
return;
|
||||
@@ -619,16 +619,16 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
std::shared_ptr<LocalPlayer> player =
|
||||
Minecraft::GetInstance()->localplayers[getPad()];
|
||||
std::shared_ptr<ItemInstance> carriedItem = nullptr;
|
||||
if (player != NULL) carriedItem = player->inventory->getCarried();
|
||||
if (player != nullptr) carriedItem = player->inventory->getCarried();
|
||||
|
||||
std::shared_ptr<ItemInstance> slotItem = nullptr;
|
||||
Slot* slot = NULL;
|
||||
Slot* slot = nullptr;
|
||||
int slotIndex = 0;
|
||||
if (bPointerIsOverSlot) {
|
||||
slotIndex = iNewSlotIndex + getSectionStartOffset(eSectionUnderPointer);
|
||||
slot = m_menu->getSlot(slotIndex);
|
||||
}
|
||||
bool bIsItemCarried = carriedItem != NULL;
|
||||
bool bIsItemCarried = carriedItem != nullptr;
|
||||
int iCarriedCount = 0;
|
||||
bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on
|
||||
// pointer as is in slot under pointer.
|
||||
@@ -648,7 +648,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
0; // How many more items can be stacked on this slot.
|
||||
if (bPointerIsOverSlot) {
|
||||
slotItem = slot->getItem();
|
||||
bSlotHasItem = slotItem != NULL;
|
||||
bSlotHasItem = slotItem != nullptr;
|
||||
if (bSlotHasItem) {
|
||||
iSlotCount = slotItem->GetCount();
|
||||
|
||||
@@ -690,11 +690,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
std::vector<HtmlString>* desc =
|
||||
GetSectionHoverText(eSectionUnderPointer);
|
||||
SetPointerText(desc, false);
|
||||
m_lastPointerLabelSlot = NULL;
|
||||
m_lastPointerLabelSlot = nullptr;
|
||||
delete desc;
|
||||
} else {
|
||||
SetPointerText(NULL, false);
|
||||
m_lastPointerLabelSlot = NULL;
|
||||
SetPointerText(nullptr, false);
|
||||
m_lastPointerLabelSlot = nullptr;
|
||||
}
|
||||
|
||||
EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack;
|
||||
@@ -833,7 +833,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
||||
bool bValidIngredient =
|
||||
FurnaceRecipes::getInstance()->getResult(
|
||||
item->getItem()->id) != NULL;
|
||||
item->getItem()->id) != nullptr;
|
||||
|
||||
if (bValidIngredient) {
|
||||
// is there already something in the ingredient slot?
|
||||
@@ -845,7 +845,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
} else {
|
||||
if (FurnaceRecipes::getInstance()->getResult(
|
||||
item->id) == NULL) {
|
||||
item->id) == nullptr) {
|
||||
buttonY = eToolTipQuickMove;
|
||||
} else {
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
@@ -874,7 +874,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
} else {
|
||||
if (FurnaceRecipes::getInstance()
|
||||
->getResult(item->id) == NULL) {
|
||||
->getResult(item->id) == nullptr) {
|
||||
buttonY = eToolTipQuickMove;
|
||||
} else {
|
||||
buttonY = eToolTipQuickMoveIngredient;
|
||||
@@ -1080,10 +1080,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
||||
bool bHandled = false;
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[getPad()] != NULL) {
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
if (tutorial != NULL) {
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->handleUIInput(iAction);
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
!tutorial->isInputAllowed(iAction)) {
|
||||
@@ -1210,12 +1210,12 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
||||
std::shared_ptr<ItemInstance> item =
|
||||
getSlotItem(m_eCurrSection, currentIndex);
|
||||
if (Minecraft::GetInstance()->localgameModes[iPad] !=
|
||||
NULL) {
|
||||
nullptr) {
|
||||
Tutorial::PopupMessageDetails* message =
|
||||
new Tutorial::PopupMessageDetails;
|
||||
message->m_messageId = item->getUseDescriptionId();
|
||||
|
||||
if (Item::items[item->id] != NULL)
|
||||
if (Item::items[item->id] != nullptr)
|
||||
message->m_titleString =
|
||||
Item::items[item->id]->getHoverName(item);
|
||||
message->m_titleId = item->getDescriptionId();
|
||||
@@ -1227,7 +1227,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)Minecraft::GetInstance()
|
||||
->localgameModes[iPad];
|
||||
gameMode->getTutorial()->setMessage(NULL, message);
|
||||
gameMode->getTutorial()->setMessage(nullptr, message);
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}
|
||||
}
|
||||
@@ -1329,7 +1329,7 @@ void IUIScene_AbstractContainerMenu::handleSlotListClicked(
|
||||
void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum,
|
||||
bool quickKey) {
|
||||
// 4J Stu - Removed this line as unused
|
||||
// if (slot != NULL) slotId = slot->index;
|
||||
// if (slot != nullptr) slotId = slot->index;
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(
|
||||
@@ -1347,7 +1347,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) {
|
||||
|
||||
bool IUIScene_AbstractContainerMenu::IsSameItemAs(
|
||||
std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB) {
|
||||
if (itemA == NULL || itemB == NULL) return false;
|
||||
if (itemA == nullptr || itemB == nullptr) return false;
|
||||
|
||||
return (itemA->id == itemB->id &&
|
||||
(!itemB->isStackedByData() ||
|
||||
@@ -1358,7 +1358,7 @@ bool IUIScene_AbstractContainerMenu::IsSameItemAs(
|
||||
int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot* slot) {
|
||||
int iResult = 0;
|
||||
|
||||
if (slot != NULL && slot->hasItem()) {
|
||||
if (slot != nullptr && slot->hasItem()) {
|
||||
std::shared_ptr<ItemInstance> item = slot->getItem();
|
||||
if (item->isStackable()) {
|
||||
int iCount = item->GetCount();
|
||||
@@ -1376,7 +1376,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot* slot) {
|
||||
|
||||
std::vector<HtmlString>* IUIScene_AbstractContainerMenu::GetItemDescription(
|
||||
Slot* slot) {
|
||||
if (slot == NULL) return NULL;
|
||||
if (slot == nullptr) return nullptr;
|
||||
|
||||
std::vector<HtmlString>* lines =
|
||||
slot->getItem()->getHoverText(nullptr, false);
|
||||
@@ -1395,5 +1395,5 @@ std::vector<HtmlString>* IUIScene_AbstractContainerMenu::GetItemDescription(
|
||||
|
||||
std::vector<HtmlString>* IUIScene_AbstractContainerMenu::GetSectionHoverText(
|
||||
ESceneSection eSection) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user