diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/BaseRailTile.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
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
Diffstat (limited to 'Minecraft.World/BaseRailTile.cpp')
| -rw-r--r-- | Minecraft.World/BaseRailTile.cpp | 20 |
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() |
