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

@@ -39,7 +39,7 @@ void StrongholdFeature::_init()
// 4J added initialisers
for (int i = 0; i < strongholdPos_length; i++)
{
strongholdPos[i] = NULL;
strongholdPos[i] = nullptr;
}
isSpotSelected = false;
}
@@ -136,11 +136,11 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
}
#endif
int selectedX = (int) (Math::round(cos(angle) * dist));
int selectedZ = (int) (Math::round(sin(angle) * dist));
int selectedX = static_cast<int>(Math::round(cos(angle) * dist));
int selectedZ = static_cast<int>(Math::round(sin(angle) * dist));
TilePos *position = level->getBiomeSource()->findBiome((selectedX << 4) + 8, (selectedZ << 4) + 8, 7 << 4, allowedBiomes, &random);
if (position != NULL)
if (position != nullptr)
{
selectedX = position->x >> 4;
selectedZ = position->z >> 4;
@@ -164,7 +164,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
delete strongholdPos[i];
strongholdPos[i] = new ChunkPos(selectedX, selectedZ);
angle += PI * 2.0 / (double) strongholdPos_length;
angle += PI * 2.0 / static_cast<double>(strongholdPos_length);
}
// 4J Stu - We want to make sure that we have at least one stronghold in this world
@@ -172,7 +172,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
// 4J Stu - Randomise the angles for retries as well
#ifdef _LARGE_WORLDS
angle = random.nextDouble() * PI * 2.0 * circle / (double) spread;
angle = random.nextDouble() * PI * 2.0 * circle / static_cast<double>(spread);
#endif
}
while(!hasFoundValidPos && findAttempts < MAX_STRONGHOLD_ATTEMPTS);
@@ -191,7 +191,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
{
bool forcePlacement = false;
LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
if( levelGenOptions != NULL )
if( levelGenOptions != nullptr )
{
forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Stronghold);
}
@@ -211,7 +211,7 @@ vector<TilePos> *StrongholdFeature::getGuesstimatedFeaturePositions()
for( int i = 0; i < strongholdPos_length; i++ )
{
ChunkPos *chunkPos = strongholdPos[i];
if (chunkPos != NULL)
if (chunkPos != nullptr)
{
positions->push_back(chunkPos->getMiddleBlockPosition(64));
}
@@ -225,7 +225,7 @@ StructureStart *StrongholdFeature::createStructureStart(int x, int z)
StrongholdStart *start = new StrongholdStart(level, random, x, z);
// 4J - front() was get(0)
while (start->getPieces()->empty() || ((StrongholdPieces::StartPiece *) start->getPieces()->front())->portalRoomPiece == NULL)
while (start->getPieces()->empty() || static_cast<StrongholdPieces::StartPiece *>(start->getPieces()->front())->portalRoomPiece == nullptr)
{
delete start;
// regenerate stronghold without changing seed
@@ -254,7 +254,7 @@ StrongholdFeature::StrongholdStart::StrongholdStart(Level *level, Random *random
vector<StructurePiece *> *pendingChildren = &startRoom->pendingChildren;
while (!pendingChildren->empty())
{
int pos = random->nextInt((int)pendingChildren->size());
int pos = random->nextInt(static_cast<int>(pendingChildren->size()));
auto it = pendingChildren->begin() + pos;
StructurePiece *structurePiece = *it;
pendingChildren->erase(it);