aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
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
Diffstat (limited to 'Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp')
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
index 6b96a4e3..d8c06ae1 100644
--- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
@@ -14,13 +14,13 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle
{
MapChildControls();
- ItemEditorInput *initData = (ItemEditorInput *)pInitData->pvInitData;
+ ItemEditorInput *initData = static_cast<ItemEditorInput *>(pInitData->pvInitData);
m_iPad = initData->iPad;
m_slot = initData->slot;
m_menu = initData->menu;
- if(m_slot != NULL) m_item = m_slot->getItem();
+ if(m_slot != nullptr) m_item = m_slot->getItem();
- if(m_item!=NULL)
+ if(m_item!=nullptr)
{
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
@@ -54,13 +54,13 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
case VK_PAD_START:
case VK_PAD_BACK:
// We need to send a packet to the server to update it's representation of this item
- if(m_slot != NULL && m_menu != NULL)
+ if(m_slot != nullptr && m_menu != nullptr)
{
m_slot->set(m_item);
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
- if(player != NULL && player->connection) player->connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) );
+ if(player != nullptr && player->connection) player->connection->send(std::make_shared<ContainerSetSlotPacket>(m_menu->containerId, m_slot->index, m_item));
}
// kill the crafting xui
app.NavigateBack(m_iPad);
@@ -76,7 +76,7 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
{
- if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(0,1,0) );
+ if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(0, 1, 0);
if(hObjSource == m_itemId)
{
int id = 0;
@@ -84,7 +84,7 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot
if(!value.empty()) id = _fromString<int>( value );
// TODO Proper validation of the valid item ids
- if(id > 0 && Item::items[id] != NULL) m_item->id = id;
+ if(id > 0 && Item::items[id] != nullptr) m_item->id = id;
}
else if(hObjSource == m_itemAuxValue)
{