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

@@ -112,7 +112,7 @@ void Level::initCache(lightCache_t *cache)
}
// Set a brightness value, going through the cache if enabled for this thread
void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness)
void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness)
{
if( cache == NULL )
{
@@ -129,8 +129,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse,
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -188,8 +188,8 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -255,8 +255,8 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00) << 38) |
( ( ((__uint64)z) & 0x3FFFC00) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -285,7 +285,7 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i
#endif
setBrightness(LightLayer::Block, xx, yy, zz, val, true);
}
// Update both emission & blocking values whilst we are here
cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID;
int t = getTile(x,y,z);
@@ -331,8 +331,8 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -361,7 +361,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
#endif
setBrightness(layer, xx, yy, zz, val, true);
}
// Update both emission & blocking values whilst we are here
cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID;
int t = getTile(x,y,z);
@@ -394,7 +394,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
// this hasn't been updated (for client threads) for each individual lighting update as would have been the case with the non-cached lighting. There's two reasons for this
// (1) it's more efficient, since we aren't doing so many individual calls to the level listener to let the renderer know what has been updated
// (2) it lets the lighting actually complete before we get any visual representation of the update, otherwise we end up seeing some strange partial updates
void Level::flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::variety layer)
void Level::flushCache(lightCache_t *cache, uint64_t cacheUse, LightLayer::variety layer)
{
// cacheUse has a single bit for each x, y and z to say whether anything with that x, y or z has been written to
if( cacheUse == 0 ) return;
@@ -596,7 +596,7 @@ Level::Level(Level *level, Dimension *dimension)
this->levelData = new LevelData(level->levelData);
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage( levelStorage.get() );
shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
@@ -660,7 +660,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName
//{
// dimension = Dimension::getNew(levelData->getDimension());
//}
else
else
{
dimension = Dimension::getNew(0);
}
@@ -676,7 +676,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
((Dimension *) dimension)->init( this );
chunkSource = doCreateChunkSource ? createChunkSource() : NULL; // 4J - added flag so chunk source can be called from derived class instead
// 4J Stu- Moved to derived classes
@@ -707,7 +707,7 @@ Level::~Level()
DeleteCriticalSection(&m_checkLightCS);
// 4J-PB - savedDataStorage is shared between overworld and nether levels in the server, so it will already have been deleted on the first level delete
if(savedDataStorage!=NULL) delete savedDataStorage;
if(savedDataStorage!=NULL) delete savedDataStorage;
DeleteCriticalSection(&m_entitiesCS);
DeleteCriticalSection(&m_tileEntityListCS);
@@ -1298,7 +1298,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z)
// the level chunk once
void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z)
{
if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) ||
if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) ||
( ( ( z & 15 ) == 0 ) || ( ( z & 15 ) == 15 ) ) ||
( ( y <= 0 ) || ( y >= 127 ) ) )
{
@@ -1591,7 +1591,7 @@ void Level::playSound(shared_ptr<Entity> entity, int iSound, float volume, float
if(entity->GetType() == eTYPE_SERVERPLAYER)
{
//app.DebugPrintf("ENTITY is serverplayer\n");
(*it)->playSound(entity,iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch);
}
else
@@ -1630,7 +1630,7 @@ void Level::playMusic(double x, double y, double z, const wstring& string, float
{
}
// 4J removed -
// 4J removed -
/*
void Level::addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd)
{
@@ -2255,7 +2255,7 @@ void Level::tickEntities()
{
entityRemoved(*it);
}
//
//
entitiesToRemove.clear();
//for (int i = 0; i < entities.size(); i++)
@@ -2268,7 +2268,7 @@ void Level::tickEntities()
for (unsigned int i = 0; i < entities.size(); )
{
shared_ptr<Entity> e = entities.at(i);
if (e->riding != NULL)
{
if (e->riding->removed || e->riding->rider.lock() != e)
@@ -2287,7 +2287,7 @@ void Level::tickEntities()
{
#ifndef _FINAL_BUILD
if(!( app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && (dynamic_pointer_cast<Mob>(e) != NULL) && (dynamic_pointer_cast<Player>(e) == NULL)))
#endif
#endif
{
tick(e);
}
@@ -2360,7 +2360,7 @@ void Level::tickEntities()
// 4J-PB - Stuart - check this is correct here
if (!tileEntitiesToUnload.empty())
{
{
//tileEntityList.removeAll(tileEntitiesToUnload);
for( AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end(); )
@@ -2767,7 +2767,7 @@ shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double
shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks)
{
shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
explosion->fire = fire;
explosion->fire = fire;
explosion->destroyBlocks = destroyBlocks;
explosion->explode();
explosion->finalizeExplosion(true);
@@ -2945,7 +2945,7 @@ bool Level::isSolidRenderTile(int x, int y, int z)
{
Tile *tile = Tile::tiles[getTile(x, y, z)];
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
// other leaves (or solid things). This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these
@@ -3008,7 +3008,7 @@ bool Level::isTopSolidBlocking(int x, int y, int z)
if (tile == NULL) return false;
if (tile->material->isSolidBlocking() && tile->isCubeShaped()) return true;
if (dynamic_cast<StairTile *>(tile) != NULL)
if (dynamic_cast<StairTile *>(tile) != NULL)
{
return (getData(x, y, z) & StairTile::UPSIDEDOWN_BIT) == StairTile::UPSIDEDOWN_BIT;
}
@@ -3159,7 +3159,7 @@ void Level::toggleDownfall()
void Level::buildAndPrepareChunksToPoll()
{
#if 0
#if 0
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
@@ -3205,7 +3205,7 @@ void Level::buildAndPrepareChunksToPoll()
delete [] xx;
delete [] zz;
#endif
if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--;
// 4J Stu - Added 1.2.3, but not sure if we want to do it
@@ -3387,7 +3387,7 @@ inline int GetIndex(int x, int y, int z)
void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive)
{
lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache);
__uint64 cacheUse = 0;
uint64_t cacheUse = 0;
if( force )
{
@@ -3416,7 +3416,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
EnterCriticalSection(&m_checkLightCS);
#ifdef __PSVITA__
// AP - only clear the one array element required to check if something has changed
// AP - only clear the one array element required to check if something has changed
cachewritten = false;
if( cache != NULL )
{
@@ -3450,7 +3450,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
#endif
// If we're in cached mode, then use memory allocated after the cached data itself for the toCheck array, in an attempt to make both that & the other cached data sit on the CPU L2 cache better.
int *toCheck;
if( cache == NULL )
{
@@ -3477,7 +3477,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
// Lock 128K of cache (containing all the lighting cache + first 112K of toCheck array) on L2 to try and stop any cached data getting knocked out of L2 by other non-cached reads (or vice-versa)
// if( cache ) XLockL2(XLOCKL2_INDEX_TITLE, cache, 128 * 1024, XLOCKL2_LOCK_SIZE_1_WAY, 0 );
{
int cc = getBrightnessCached(cache, layer, xc, yc, zc);
int ex = 0;
@@ -3713,7 +3713,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
/////////////////////////////////////////////////////////////////
#endif
LeaveCriticalSection(&m_checkLightCS);
}
@@ -3905,7 +3905,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;//entities.at(i);
float sd = e->distanceTo(x,y,z);
if (sd * sd > range * range)
{
@@ -4149,7 +4149,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(shared_ptr<Entity> source,
shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist)
{
double best = -1;
shared_ptr<Player> result = nullptr;
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
@@ -4179,7 +4179,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double
}
visibleDist *= (.7f * coverPercentage);
}
// 4J Stu - Added check that this player is still alive and privilege check
if ((visibleDist < 0 || dist < visibleDist * visibleDist) && (best == -1 || dist < best) && p->isAlive() && !p->hasInvisiblePrivilege())
{
@@ -4318,16 +4318,16 @@ void Level::checkSession()
}
void Level::setTime(__int64 time)
void Level::setTime(int64_t time)
{
// 4J : WESTY : Added to track game time played by players for other awards.
if (time != 0) // Ignore setting time to 0, done at level start and during tutorial.
{
// Determine step in time and ensure it is reasonable ( we only have an int to store the player stat).
__int64 timeDiff = time - levelData->getTime();
int64_t timeDiff = time - levelData->getTime();
// debug setting added to keep it at day time
#ifndef _FINAL_BUILD
#ifndef _FINAL_BUILD
if(app.DebugSettingsOn())
{
if(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_FreezeTime))
@@ -4363,18 +4363,18 @@ void Level::setTime(__int64 time)
this->levelData->setTime(time);
}
void Level::setOverrideTimeOfDay(__int64 time)
void Level::setOverrideTimeOfDay(int64_t time)
{
m_timeOfDayOverride = time;
}
__int64 Level::getSeed()
int64_t Level::getSeed()
{
return levelData->getSeed();
}
__int64 Level::getTime()
int64_t Level::getTime()
{
return levelData->getTime();
}
@@ -4529,7 +4529,7 @@ int Level::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int ce
return savedDataStorage->getAuxValueForMap(xuid, dimension, centreXC, centreZC, scale);
}
// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data)
// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data)
// {
// auto itEnd = listeners.end();
// for (auto it = listeners.begin(); it != itEnd; it++)
@@ -4565,7 +4565,7 @@ int Level::getHeight()
Random *Level::getRandomFor(int x, int z, int blend)
{
__int64 seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend;
int64_t seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend;
random->setSeed(seed);
return random;
}
@@ -4585,9 +4585,9 @@ bool Level::isAllEmpty()
return false;
}
double Level::getHorizonHeight()
double Level::getHorizonHeight()
{
if (levelData->getGenerator() == LevelType::lvl_flat)
if (levelData->getGenerator() == LevelType::lvl_flat)
{
return 0.0;
}