aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UILayer.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/Common/UI/UILayer.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* 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 * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/Common/UI/UILayer.cpp')
-rw-r--r--Minecraft.Client/Common/UI/UILayer.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp
index 2063778b..e1c388f5 100644
--- a/Minecraft.Client/Common/UI/UILayer.cpp
+++ b/Minecraft.Client/Common/UI/UILayer.cpp
@@ -102,7 +102,7 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
bool UILayer::IsSceneInStack(EUIScene scene)
{
bool inStack = false;
- for(int i = m_sceneStack.size() - 1;i >= 0; --i)
+ for(int i = static_cast<int>(m_sceneStack.size()) - 1; i >= 0; --i)
{
if(m_sceneStack[i]->getSceneType() == scene)
{
@@ -118,7 +118,7 @@ bool UILayer::HasFocus(int iPad)
bool hasFocus = false;
if(m_hasFocus)
{
- for(int i = m_sceneStack.size() - 1;i >= 0; --i)
+ for(int i = (int)m_sceneStack.size() - 1; i >= 0; --i)
{
if(m_sceneStack[i]->stealsFocus() )
{
@@ -146,7 +146,7 @@ bool UILayer::hidesLowerScenes()
}
if(!hidesScenes && !m_sceneStack.empty())
{
- for(int i = m_sceneStack.size() - 1;i >= 0; --i)
+ for(int i = static_cast<int>(m_sceneStack.size()) - 1; i >= 0; --i)
{
if(m_sceneStack[i]->hidesLowerScenes())
{
@@ -197,7 +197,7 @@ bool UILayer::GetMenuDisplayed()
bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
{
- UIScene *newScene = NULL;
+ UIScene *newScene = nullptr;
switch(scene)
{
// Debug
@@ -424,7 +424,7 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
break;
};
- if(newScene == NULL)
+ if(newScene == nullptr)
{
app.DebugPrintf("WARNING: Scene %d was not created. Add it to UILayer::NavigateToScene\n", scene);
return false;
@@ -451,7 +451,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene)
bool navigated = false;
if(eScene < eUIScene_COUNT)
{
- UIScene *scene = NULL;
+ UIScene *scene = nullptr;
do
{
scene = m_sceneStack.back();
@@ -523,9 +523,9 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
return itComp;
}
}
- return NULL;
+ return nullptr;
}
- UIScene *newScene = NULL;
+ UIScene *newScene = nullptr;
switch(scene)
{
@@ -573,7 +573,7 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
break;
};
- if(newScene == NULL) return NULL;
+ if(newScene == nullptr) return nullptr;
m_components.push_back(newScene);
@@ -661,12 +661,12 @@ void UILayer::closeAllScenes()
}
}
-// Get top scene on stack (or NULL if stack is empty)
+// Get top scene on stack (or nullptr if stack is empty)
UIScene *UILayer::GetTopScene()
{
if(m_sceneStack.size() == 0)
{
- return NULL;
+ return nullptr;
}
else
{
@@ -789,7 +789,7 @@ UIScene *UILayer::getCurrentScene()
}
}
- return NULL;
+ return nullptr;
}
#endif
@@ -894,10 +894,10 @@ void UILayer::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
totalDynamic += layerDynamic;
}
-// Returns the first scene of given type if it exists, NULL otherwise
+// Returns the first scene of given type if it exists, nullptr otherwise
UIScene *UILayer::FindScene(EUIScene sceneType)
{
- for (int i = 0; i < m_sceneStack.size(); i++)
+ for (size_t i = 0; i < m_sceneStack.size(); i++)
{
if (m_sceneStack[i]->getSceneType() == sceneType)
{
@@ -905,5 +905,5 @@ UIScene *UILayer::FindScene(EUIScene sceneType)
}
}
- return NULL;
+ return nullptr;
} \ No newline at end of file