aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Region.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/Region.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
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 a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.World/Region.cpp')
-rw-r--r--Minecraft.World/Region.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/Minecraft.World/Region.cpp b/Minecraft.World/Region.cpp
index 1e8acaf3..e3e91bf0 100644
--- a/Minecraft.World/Region.cpp
+++ b/Minecraft.World/Region.cpp
@@ -45,7 +45,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int
for (int zc = zc1; zc <= zc2; zc++)
{
LevelChunk *chunk = level->getChunk(xc, zc);
- if(chunk != nullptr)
+ if(chunk != NULL)
{
LevelChunkArray *lca = (*chunks)[xc - xc1];
lca->data[zc - zc1] = chunk;
@@ -58,7 +58,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int
{
LevelChunkArray *lca = (*chunks)[xc - xc1];
LevelChunk *chunk = lca->data[zc - zc1];
- if (chunk != nullptr)
+ if (chunk != NULL)
{
if (!chunk->isYSpaceEmpty(y1, y2))
{
@@ -71,7 +71,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int
// AP - added a caching system for Chunk::rebuild to take advantage of
xcCached = -1;
zcCached = -1;
- CachedTiles = nullptr;
+ CachedTiles = NULL;
}
bool Region::isAllEmpty()
@@ -105,13 +105,13 @@ int Region::getTile(int x, int y, int z)
xc -= xc1;
zc -= zc1;
- if (xc < 0 || xc >= static_cast<int>(chunks->length) || zc < 0 || zc >= static_cast<int>((*chunks)[xc]->length))
+ if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length)
{
return 0;
}
LevelChunk *lc = (*chunks)[xc]->data[zc];
- if (lc == nullptr) return 0;
+ if (lc == NULL) return 0;
return lc->getTile(x & 15, y, z & 15);
}
@@ -122,9 +122,9 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc)
xcCached = xc;
zcCached = zc;
int size = 16 * 16 * Level::maxBuildHeight;
- if( CachedTiles == nullptr )
+ if( CachedTiles == NULL )
{
- CachedTiles = static_cast<unsigned char *>(malloc(size));
+ CachedTiles = (unsigned char *) malloc(size);
}
memcpy(CachedTiles, tiles, size);
}
@@ -132,14 +132,14 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc)
LevelChunk* Region::getLevelChunk(int x, int y, int z)
{
if (y < 0) return 0;
- if (y >= Level::maxBuildHeight) return nullptr;
+ if (y >= Level::maxBuildHeight) return NULL;
int xc = (x >> 4) - xc1;
int zc = (z >> 4) - zc1;
- if (xc < 0 || xc >= static_cast<int>(chunks->length) || zc < 0 || zc >= static_cast<int>((*chunks)[xc]->length))
+ if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length)
{
- return nullptr;
+ return NULL;
}
LevelChunk *lc = (*chunks)[xc]->data[zc];
@@ -263,7 +263,7 @@ Biome *Region::getBiome(int x, int z)
bool Region::isSolidRenderTile(int x, int y, int z)
{
Tile *tile = Tile::tiles[getTile(x, y, z)];
- if (tile == nullptr) return false;
+ if (tile == NULL) return false;
// 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so
// blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by
@@ -278,7 +278,7 @@ bool Region::isSolidRenderTile(int x, int y, int z)
for( int i = 0; i < 6; i++ )
{
int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]);
- if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) )
+ if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) )
{
return false;
}
@@ -294,7 +294,7 @@ bool Region::isSolidRenderTile(int x, int y, int z)
bool Region::isSolidBlockingTile(int x, int y, int z)
{
Tile *tile = Tile::tiles[getTile(x, y, z)];
- if (tile == nullptr) return false;
+ if (tile == NULL) return false;
return tile->material->blocksMotion() && tile->isCubeShaped();
}
@@ -307,7 +307,7 @@ bool Region::isTopSolidBlocking(int x, int y, int z)
bool Region::isEmptyTile(int x, int y, int z)
{
Tile *tile = Tile::tiles[getTile(x, y, z)];
- return (tile == nullptr);
+ return (tile == NULL);
}