aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BaseRailTile.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/BaseRailTile.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* 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 * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.World/BaseRailTile.cpp')
-rw-r--r--Minecraft.World/BaseRailTile.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Minecraft.World/BaseRailTile.cpp b/Minecraft.World/BaseRailTile.cpp
index db854bb3..0494e266 100644
--- a/Minecraft.World/BaseRailTile.cpp
+++ b/Minecraft.World/BaseRailTile.cpp
@@ -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()