diff options
Diffstat (limited to 'Minecraft.World/TheEndLevelRandomLevelSource.cpp')
| -rw-r--r-- | Minecraft.World/TheEndLevelRandomLevelSource.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 67d85a92..3b42f8ca 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/TheEndLevelRandomLevelSource.cpp @@ -9,7 +9,7 @@ #include "net.minecraft.world.level.storage.h" #include "TheEndLevelRandomLevelSource.h" -TheEndLevelRandomLevelSource::TheEndLevelRandomLevelSource(Level *level, __int64 seed) +TheEndLevelRandomLevelSource::TheEndLevelRandomLevelSource(Level *level, int64_t seed) { m_XZSize = END_LEVEL_MIN_WIDTH; @@ -53,7 +53,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra { for (int yc = 0; yc < Level::genDepth / CHUNK_HEIGHT; yc++) { - double yStep = 1 / (double) CHUNK_HEIGHT; + double yStep = 1 / static_cast<double>(CHUNK_HEIGHT); double s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; double s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; double s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; @@ -66,7 +66,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra for (int y = 0; y < CHUNK_HEIGHT; y++) { - double xStep = 1 / (double) CHUNK_WIDTH; + double xStep = 1 / static_cast<double>(CHUNK_WIDTH); double _s0 = s0; double _s1 = s1; @@ -77,7 +77,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra { int offs = (x + xc * CHUNK_WIDTH) << Level::genDepthBitsPlusFour | (0 + zc * CHUNK_WIDTH) << Level::genDepthBits | (yc * CHUNK_HEIGHT + y); int step = 1 << Level::genDepthBits; - double zStep = 1 / (double) CHUNK_WIDTH; + double zStep = 1 / static_cast<double>(CHUNK_WIDTH); double val = _s0; double vala = (_s1 - _s0) * zStep; @@ -90,7 +90,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra } else { } - blocks[offs] = (byte) tileId; + blocks[offs] = static_cast<byte>(tileId); offs += step; val += vala; } @@ -139,7 +139,7 @@ void TheEndLevelRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray if (runDepth <= 0) { top = 0; - material = (byte) Tile::endStone_Id; + material = static_cast<byte>(Tile::endStone_Id); } run = runDepth; @@ -169,7 +169,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) BiomeArray biomes; // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed unsigned int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast<byte *>(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -195,7 +195,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) doubleArray TheEndLevelRandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize) { - if (buffer.data == NULL) + if (buffer.data == nullptr) { buffer = doubleArray(xSize * ySize * zSize); } @@ -370,10 +370,10 @@ void TheEndLevelRandomLevelSource::postProcess(ChunkSource *parent, int xt, int // 4J - added. The original java didn't do any setting of the random seed here, and passes the level random to the biome decorator. // We'll be running our postProcess in parallel with getChunk etc. so we need to use a separate random - have used the same initialisation code as - // used in RandomLevelSource::postProcess to make sure this random value is consistent for each world generation. + // used in RandomLevelSource::postProcess to make sure this random value is consistent for each world generation. pprandom->setSeed(level->getSeed()); - __int64 xScale = pprandom->nextLong() / 2 * 2 + 1; - __int64 zScale = pprandom->nextLong() / 2 * 2 + 1; + int64_t xScale = pprandom->nextLong() / 2 * 2 + 1; + int64_t zScale = pprandom->nextLong() / 2 * 2 + 1; pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed()); Biome *biome = level->getBiome(xo + 16, zo + 16); @@ -407,16 +407,16 @@ wstring TheEndLevelRandomLevelSource::gatherStats() vector<Biome::MobSpawnerData *> *TheEndLevelRandomLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } return biome->getMobs(mobCategory); } TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } void TheEndLevelRandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) |
