Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -44,7 +44,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list<StructurePiece *> *
if (randomSelection >= 80)
{
BoundingBox *crossingBox = MineShaftCrossing::findCrossing(pieces, random, footX, footY, footZ, direction);
if (crossingBox != nullptr)
if (crossingBox != NULL)
{
return new MineShaftCrossing(genDepth, random, crossingBox, direction);
}
@@ -52,7 +52,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list<StructurePiece *> *
else if (randomSelection >= 70)
{
BoundingBox *stairsBox = MineShaftStairs::findStairs(pieces, random, footX, footY, footZ, direction);
if (stairsBox != nullptr)
if (stairsBox != NULL)
{
return new MineShaftPieces::MineShaftStairs(genDepth, random, stairsBox, direction);
}
@@ -60,28 +60,28 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list<StructurePiece *> *
else
{
BoundingBox *corridorBox = MineShaftCorridor::findCorridorSize(pieces, random, footX, footY, footZ, direction);
if (corridorBox != nullptr)
if (corridorBox != NULL)
{
return new MineShaftCorridor(genDepth, random, corridorBox, direction);
}
}
return nullptr;
return NULL;
}
StructurePiece *MineShaftPieces::generateAndAddPiece(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth)
{
if (depth > MAX_DEPTH)
{
return nullptr;
return NULL;
}
if (abs(footX - startPiece->getBoundingBox()->x0) > 5 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 5 * 16)
{
return nullptr;
return NULL;
}
StructurePiece *newPiece = createRandomShaftPiece(pieces, random, footX, footY, footZ, direction, depth + 1);
if (newPiece != nullptr)
if (newPiece != NULL)
{
MemSect(50);
pieces->push_back(newPiece);
@@ -132,7 +132,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis
break;
}
StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 - 1, Direction::NORTH, depth);
if (child != nullptr)
if (child != NULL)
{
BoundingBox *childBox = child->getBoundingBox();
childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z0, childBox->x1, childBox->y1, boundingBox->z0 + 1));
@@ -149,7 +149,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis
break;
}
StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z1 + 1, Direction::SOUTH, depth);
if (child != nullptr)
if (child != NULL)
{
BoundingBox *childBox = child->getBoundingBox();
childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z1 - 1, childBox->x1, childBox->y1, boundingBox->z1));
@@ -166,7 +166,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis
break;
}
StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::WEST, depth);
if (child != nullptr)
if (child != NULL)
{
BoundingBox *childBox = child->getBoundingBox();
childEntranceBoxes.push_back(new BoundingBox(boundingBox->x0, childBox->y0, childBox->z0, boundingBox->x0 + 1, childBox->y1, childBox->z1));
@@ -183,7 +183,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis
break;
}
StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::EAST, depth);
if (child != nullptr)
if (child != NULL)
{
BoundingBox *childBox = child->getBoundingBox();
childEntranceBoxes.push_back(new BoundingBox(boundingBox->x1 - 1, childBox->y0, childBox->z0, boundingBox->x1, childBox->y1, childBox->z1));
@@ -304,7 +304,7 @@ BoundingBox *MineShaftPieces::MineShaftCorridor::findCorridorSize(list<Structure
break;
}
if (StructurePiece::findCollisionPiece(pieces, box) != nullptr)
if (StructurePiece::findCollisionPiece(pieces, box) != NULL)
{
corridorLength--;
}
@@ -320,7 +320,7 @@ BoundingBox *MineShaftPieces::MineShaftCorridor::findCorridorSize(list<Structure
}
delete box;
// unable to place corridor here
return nullptr;
return NULL;
}
void MineShaftPieces::MineShaftCorridor::addChildren(StructurePiece *startPiece, list<StructurePiece *> *pieces, Random *random)
@@ -434,7 +434,7 @@ bool MineShaftPieces::MineShaftCorridor::createChest(Level *level, BoundingBox *
if (level->getTile(worldX, worldY, worldZ) == 0)
{
level->setTileAndData(worldX, worldY, worldZ, Tile::rail_Id, getOrientationData(Tile::rail_Id, random->nextBoolean() ? RailTile::DIR_FLAT_X : RailTile::DIR_FLAT_Z), Tile::UPDATE_CLIENTS);
shared_ptr<MinecartChest> chest = std::make_shared<MinecartChest>(level, worldX + 0.5f, worldY + 0.5f, worldZ + 0.5f);
shared_ptr<MinecartChest> chest = shared_ptr<MinecartChest>( new MinecartChest(level, worldX + 0.5f, worldY + 0.5f, worldZ + 0.5f) );
WeighedTreasure::addChestItems(random, treasure, chest, numRolls);
level->addEntity(chest);
return true;
@@ -515,7 +515,7 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando
hasPlacedSpider = true;
level->setTileAndData(x, y, newZ, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS);
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, newZ) );
if (entity != nullptr) entity->getSpawner()->setEntityId(L"CaveSpider");
if (entity != NULL) entity->getSpawner()->setEntityId(L"CaveSpider");
}
}
}
@@ -605,10 +605,10 @@ BoundingBox *MineShaftPieces::MineShaftCrossing::findCrossing(list<StructurePiec
break;
}
if (StructurePiece::findCollisionPiece(pieces, box) != nullptr)
if (StructurePiece::findCollisionPiece(pieces, box) != NULL)
{
delete box;
return nullptr;
return NULL;
}
return box;
@@ -746,10 +746,10 @@ BoundingBox *MineShaftPieces::MineShaftStairs::findStairs(list<StructurePiece *>
break;
}
if (StructurePiece::findCollisionPiece(pieces, box) != nullptr)
if (StructurePiece::findCollisionPiece(pieces, box) != NULL)
{
delete box;
return nullptr;
return NULL;
}
return box;