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

@@ -8,8 +8,9 @@
#include "..\Minecraft.World\File.h"
#include "..\Minecraft.World\StringHelpers.h"
#include "Minimap.h"
#include "Common/UI/UI.h"
TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = NULL;
TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr;
TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *minecraft)
{
@@ -17,7 +18,7 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m
// 4J - added
usingWeb = false;
selected = NULL;
selected = nullptr;
texturePacks = new vector<TexturePack *>;
this->minecraft = minecraft;
@@ -28,9 +29,9 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m
DEFAULT_TEXTURE_PACK->loadColourTable();
m_dummyTexturePack = NULL;
m_dummyDLCTexturePack = NULL;
lastSelected = NULL;
m_dummyTexturePack = nullptr;
m_dummyDLCTexturePack = nullptr;
lastSelected = nullptr;
updateList();
}
@@ -49,13 +50,13 @@ void TexturePackRepository::addDebugPacks()
{
DLCPack *pack = app.m_dlcManager.getPack(L"DLCTestPack");
if( pack != NULL && pack->IsCorrupt() )
if( pack != nullptr && pack->IsCorrupt() )
{
app.m_dlcManager.removePack(pack);
pack = NULL;
pack = nullptr;
}
if(pack == NULL)
if(pack == nullptr)
{
wprintf(L"Pack \"%ls\" is not installed, so adding it\n", L"DLCTestPack");
pack = new DLCPack(L"DLCTestPack",0xffffffff);
@@ -164,7 +165,7 @@ void TexturePackRepository::updateList()
currentPacks->push_back(m_dummyTexturePack);
cacheById[m_dummyTexturePack->getId()] = m_dummyTexturePack;
if(m_dummyDLCTexturePack != NULL)
if(m_dummyDLCTexturePack != nullptr)
{
currentPacks->push_back(m_dummyDLCTexturePack);
cacheById[m_dummyDLCTexturePack->getId()] = m_dummyDLCTexturePack;
@@ -227,7 +228,7 @@ wstring TexturePackRepository::getIdOrNull(File file)
return file.getName() + ":folder:" + file.lastModified();
}
return NULL;
return nullptr;
#endif
return L"";
}
@@ -357,17 +358,17 @@ TexturePack *TexturePackRepository::getTexturePackById(DWORD id)
return it->second;
}
return NULL;
return nullptr;
}
TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, DWORD id)
{
TexturePack *newPack = NULL;
TexturePack *newPack = nullptr;
// 4J-PB - The City texture pack went out with a child id for the texture pack of 1 instead of zero
// we need to mask off the child id here to deal with this
DWORD dwParentID=id&0xFFFFFF; // child id is <<24 and Or'd with parent
if(dlcPack != NULL)
if(dlcPack != nullptr)
{
newPack = new DLCTexturePack(dwParentID, dlcPack, DEFAULT_TEXTURE_PACK);
texturePacks->push_back(newPack);
@@ -408,7 +409,7 @@ void TexturePackRepository::removeTexturePackById(DWORD id)
texturePacks->erase(it2);
if(lastSelected == oldPack)
{
lastSelected = NULL;
lastSelected = nullptr;
}
}
m_texturePacksToDelete.push_back(oldPack);
@@ -417,19 +418,19 @@ void TexturePackRepository::removeTexturePackById(DWORD id)
void TexturePackRepository::updateUI()
{
if(lastSelected != NULL && lastSelected != selected)
if(lastSelected != nullptr && lastSelected != selected)
{
lastSelected->unloadUI();
selected->loadUI();
Minimap::reloadColours();
ui.StartReloadSkinThread();
lastSelected = NULL;
lastSelected = nullptr;
}
}
bool TexturePackRepository::needsUIUpdate()
{
return lastSelected != NULL && lastSelected != selected;
return lastSelected != nullptr && lastSelected != selected;
}
unsigned int TexturePackRepository::getTexturePackCount()
@@ -439,7 +440,7 @@ unsigned int TexturePackRepository::getTexturePackCount()
TexturePack *TexturePackRepository::getTexturePackByIndex(unsigned int index)
{
TexturePack *pack = NULL;
TexturePack *pack = nullptr;
if(index < texturePacks->size())
{
pack = texturePacks->at(index);