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

@@ -19,7 +19,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z)
if(m_bValidRail)
{
int direction = level->getData(x, y, z);
if (((BaseRailTile *) Tile::tiles[id])->usesDataBit)
if (static_cast<BaseRailTile *>(Tile::tiles[id])->usesDataBit)
{
usesDataBit = true;
direction = direction & ~RAIL_DATA_BIT;
@@ -34,7 +34,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z)
BaseRailTile::Rail::~Rail()
{
for( int i = 0; i < connections.size(); i++ )
for( size_t i = 0; i < connections.size(); i++ )
{
delete connections[i];
}
@@ -44,7 +44,7 @@ void BaseRailTile::Rail::updateConnections(int direction)
{
if(m_bValidRail)
{
for( int i = 0; i < connections.size(); i++ )
for( size_t i = 0; i < connections.size(); i++ )
{
delete connections[i];
}
@@ -102,7 +102,7 @@ void BaseRailTile::Rail::removeSoftConnections()
for (unsigned int i = 0; i < connections.size(); i++)
{
Rail *rail = getRail(connections[i]);
if (rail == NULL || !rail->connectsTo(this))
if (rail == nullptr || !rail->connectsTo(this))
{
delete connections[i];
connections.erase(connections.begin()+i);
@@ -130,11 +130,11 @@ bool BaseRailTile::Rail::hasRail(int x, int y, int z)
BaseRailTile::Rail *BaseRailTile::Rail::getRail(TilePos *p)
{
if(!m_bValidRail) return NULL;
if(!m_bValidRail) return nullptr;
if (isRail(level, p->x, p->y, p->z)) return new Rail(level, p->x, p->y, p->z);
if (isRail(level, p->x, p->y + 1, p->z)) return new Rail(level, p->x, p->y + 1, p->z);
if (isRail(level, p->x, p->y - 1, p->z)) return new Rail(level, p->x, p->y - 1, p->z);
return NULL;
return nullptr;
}
@@ -253,7 +253,7 @@ bool BaseRailTile::Rail::hasNeighborRail(int x, int y, int z)
if(!m_bValidRail) return false;
TilePos tp(x,y,z);
Rail *neighbor = getRail( &tp );
if (neighbor == NULL) return false;
if (neighbor == nullptr) return false;
neighbor->removeSoftConnections();
bool retval = neighbor->canConnectTo(this);
delete neighbor;
@@ -331,7 +331,7 @@ void BaseRailTile::Rail::place(bool hasSignal, bool first)
for ( auto& it : connections )
{
Rail *neighbor = getRail(it);
if (neighbor == NULL) continue;
if (neighbor == nullptr) continue;
neighbor->removeSoftConnections();
if (neighbor->canConnectTo(this))
@@ -359,7 +359,7 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit) : Tile(id, Material::decora
this->usesDataBit = usesDataBit;
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
iconTurn = NULL;
iconTurn = nullptr;
}
bool BaseRailTile::isUsesDataBit()
@@ -369,7 +369,7 @@ bool BaseRailTile::isUsesDataBit()
AABB *BaseRailTile::getAABB(Level *level, int x, int y, int z)
{
return NULL;
return nullptr;
}
bool BaseRailTile::blocksLight()