Get rid of MSVC's __int64

Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
This commit is contained in:
void_17
2026-03-02 15:53:32 +07:00
parent d6ec138710
commit d63f79325f
308 changed files with 5371 additions and 5379 deletions

View File

@@ -51,7 +51,7 @@ void LevelChunk::init(Level *level, int x, int z)
biomes = byteArray(16 * 16);
for(int i = 0; i < 16 * 16; i++ )
{
biomes[i] = 0xff;
biomes[i] = 0xff;
}
#ifdef _ENTITIES_RW_SECTION
EnterCriticalRWSection(&m_csEntities, true);
@@ -103,12 +103,12 @@ void LevelChunk::init(Level *level, int x, int z)
// Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255
for(int i = 0; i < 16 * 16; i++ )
{
rainHeights[i] = 255;
rainHeights[i] = 255;
}
// 4J - lighting change brought forward from 1.8.2, introduced an array of bools called gapsToRecheck, which are now a single bit in array of nybble flags in this version
for(int i = 0; i < 8 * 16; i++ )
{
columnFlags[i] = 0;
columnFlags[i] = 0;
}
// 4J added - to flag if any emissive tile has been added to this chunk (will be cleared when lighting has been successfully completed for this chunk). Defaulting to true
@@ -183,7 +183,7 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) : ENTITY_BL
// skyLight = new DataLayer(blocks.length, level->depthBits);
// blockLight = new DataLayer(blocks.length, level->depthBits);
if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT)
if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT)
{
if(blocks.length > Level::COMPRESSED_CHUNK_SECTION_TILES) upperBlocks = new CompressedTileStorage(blocks,Level::COMPRESSED_CHUNK_SECTION_TILES);
else upperBlocks = new CompressedTileStorage(true);
@@ -388,7 +388,7 @@ void LevelChunk::startSharingTilesAndData(int forceMs)
else
{
// Only force if it has been more than forceMs milliseconds since we last wanted to unshare this chunk
__int64 timenow = System::currentTimeMillis();
int64_t timenow = System::currentTimeMillis();
if( ( timenow - lastUnsharedTime ) < forceMs )
{
LeaveCriticalSection(&m_csSharing);
@@ -551,7 +551,7 @@ void LevelChunk::recalcHeightmap()
{
int y = Level::maxBuildHeight - 1;
// int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed
#ifdef __PSVITA__
int Index = ( x << 11 ) + ( z << 7 );
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
@@ -656,7 +656,7 @@ void LevelChunk::recalcHeightmap()
void LevelChunk::lightLava()
{
if( !emissiveAdded ) return;
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
{
@@ -697,7 +697,7 @@ void LevelChunk::recheckGaps(bool bForce)
// 4J added - otherwise we can end up doing a very broken kind of lighting since for an empty chunk, the heightmap is all zero, but it
// still has an x and z of 0 which means that the level->getHeightmap references in here find a real chunk near the origin, and then attempt
// to light massive gaps between the height of 0 and whatever heights are in those.
if( isEmpty() ) return;
if( isEmpty() ) return;
// 4J added
int minXZ = - (level->dimension->getXZSize() * 16 ) / 2;
@@ -765,7 +765,7 @@ void LevelChunk::lightGap(int x, int z, int source)
{
lightGap(x, z, source, height + 1);
}
else if (height < source)
else if (height < source)
{
lightGap(x, z, height, source + 1);
}
@@ -793,7 +793,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
if (yStart > yOld) y = yStart;
// int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed
CompressedTileStorage *blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks;
while (y > 0 && Tile::lightBlock[blocks->get(x,(y-1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z) & 0xff] == 0) // 4J - blocks->get() was blocks[p + y - 1]
{
@@ -845,7 +845,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
}
int br = 15;
SparseLightStorage *skyLight = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT? upperSkyLight : lowerSkyLight;
while (y > 0 && br > 0)
{
@@ -891,7 +891,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
/**
* The purpose of this method is to allow the EmptyLevelChunk to be all air
* but still block light. See EmptyLevelChunk.java
*
*
* @param x
* @param y
* @param z
@@ -921,7 +921,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data)
}
int oldHeight = heightmap[slot] & 0xff;
CompressedTileStorage *blocks = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks : lowerBlocks;
SparseDataStorage *data = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperData : lowerData;
int old = blocks->get(x,y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z);
@@ -1116,12 +1116,12 @@ void LevelChunk::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety
brightnesses[5] = light->get(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z + 1);
}
if( layer == LightLayer::Sky ) light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight;
else light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight;
if(light) brightnesses[2] = light->get(x, (y - 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z);
if( layer == LightLayer::Sky ) light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight;
else light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight;
if(light) brightnesses[3] = light->get(x, (y + 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z);
@@ -1227,7 +1227,7 @@ void LevelChunk::removeEntity(shared_ptr<Entity> e, int yc)
// MGH - have to sort this C++11 code
static bool bShowMsg = true;
if(bShowMsg)
{
{
app.DebugPrintf("Need to add C++11 shrink_to_fit for PS3\n");
bShowMsg = false;
}
@@ -1282,7 +1282,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
int t = getTile(x, y, z);
if (t <= 0 || !Tile::tiles[t]->isEntityTile()) return nullptr;
// 4J-PB changed from this in 1.7.3
//EntityTile *et = (EntityTile *) Tile::tiles[t];
//et->onPlace(level, this->x * 16 + x, y, this->z * 16 + z);
@@ -1316,7 +1316,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
LeaveCriticalSection(&m_csTileEntities);
return nullptr;
}
return tileEntity;
}
@@ -1631,7 +1631,7 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared
for (int yc = yc0; yc <= yc1; yc++)
{
vector<shared_ptr<Entity> > *entities = entityBlocks[yc];
AUTO_VAR(itEnd, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
@@ -1879,7 +1879,7 @@ void LevelChunk::setCheckAllLight()
checkLightPosition = 0;
}
Random *LevelChunk::getRandom(__int64 l)
Random *LevelChunk::getRandom(int64_t l)
{
return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l);
}
@@ -2130,7 +2130,7 @@ void LevelChunk::setSkyLightDataAllBright()
void LevelChunk::compressLighting()
{
// The lighting data is now generally not shared between host & local client, but is for a while at the start of level creation (until the point where the chunk data would be transferred by network
// data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on
// data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on
lowerSkyLight->compress();
upperSkyLight->compress();
lowerBlockLight->compress();
@@ -2400,7 +2400,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA
int y1 = y0 + ys;
unsigned int tileCount = xs * ys * zs;
unsigned int halfTileCount = tileCount/2;
int sectionHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT;
int lowerYSpan = min(y1, sectionHeight) - y0;
int upperYSpan = ys - lowerYSpan;
@@ -2439,7 +2439,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA
//setBlocksAndData(*data, x0, y0, z0, x1, y1, z1, p);
//// If it is a full chunk, we'll need to rearrange into the order the rest of the game expects
//if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) )
//if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) )
//{
// byteArray newBuffer = byteArray(81920);
// for( int x = 0; x < 16; x++ )