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
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -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(size_t i = (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(size_t 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(size_t i = (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;
}