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

@@ -19,17 +19,17 @@ private:
ConsoleSchematicFile::ESchematicRotation m_rotation;
int m_dimension;
__int64 m_totalBlocksChanged;
__int64 m_totalBlocksChangedLighting;
int64_t m_totalBlocksChanged;
int64_t m_totalBlocksChangedLighting;
bool m_completed;
void updateLocationBox();
public:
public:
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
~ApplySchematicRuleDefinition();
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);

View File

@@ -38,7 +38,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
dos->writeInt(m_zSize);
byteArray ba(new BYTE[ m_data.length ], m_data.length);
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
m_data.data, m_data.length);
dos->writeInt(ba.length);
@@ -71,13 +71,13 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
m_ySize = dis->readInt();
m_zSize = dis->readInt();
int compressedSize = dis->readInt();
int compressedSize = dis->readInt();
byteArray compressedBuffer(compressedSize);
dis->readFully(compressedBuffer);
if(m_data.data != NULL)
{
delete [] m_data.data;
delete [] m_data.data;
m_data.data = NULL;
}
@@ -145,7 +145,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
double z = pos->get(2)->data;
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
{
{
x = ((IntTag *) eTag->get(L"TileX") )->data;
y = ((IntTag *) eTag->get(L"TileY") )->data;
z = ((IntTag *) eTag->get(L"TileZ") )->data;
@@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
delete tag;
}
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
@@ -281,7 +281,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// blockData[i] = Tile::whiteStone_Id;
// }
//}
PIXBeginNamedEvent(0,"Setting Block data");
chunk->setBlockData(blockData);
PIXEndNamedEvent();
@@ -323,7 +323,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so
// we can do the sort of lighting that might propagate out of the chunk.
__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
int64_t ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
@@ -447,7 +447,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
if ( teCopy != NULL )
{
{
CompoundTag *teData = new CompoundTag();
te->save(teData);
@@ -480,7 +480,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
{
Vec3 *source = it->first;
double targetX = source->x;
double targetY = source->y + destinationBox->y0;
double targetZ = source->z;
@@ -500,7 +500,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
if( e->GetType() == eTYPE_PAINTING )
{
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
double tileX = painting->xTile;
double tileZ = painting->zTile;
schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ);
@@ -513,7 +513,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
else if( e->GetType() == eTYPE_ITEM_FRAME )
{
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
double tileX = frame->xTile;
double tileZ = frame->zTile;
schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ);
@@ -561,7 +561,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
zStart-=1;
else if(zStart < 0 && zStart%2 !=0)
zStart-=1;
// We want the end to be odd to have a total size that is even
if(xEnd > 0 && xEnd%2 == 0)
xEnd+=1;
@@ -615,7 +615,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
// Every x is a whole row
for(int xPos = xStart; xPos < xStart + xSize; ++xPos)
{
{
int xc = xPos >> 4;
int x0 = xPos - xc * 16;
@@ -624,7 +624,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
if (x1 > 16) x1 = 16;
for(int zPos = zStart; zPos < zStart + zSize;)
{
{
int zc = zPos >> 4;
int z0 = zStart - zc * 16;
@@ -718,7 +718,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
{
CompoundTag *eTag = new CompoundTag();
if( e->save(eTag) )
{
{
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos");
pos->get(0)->data -= xStart;
@@ -726,7 +726,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
pos->get(2)->data -= zStart;
if( e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME )
{
{
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
@@ -767,7 +767,7 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data,
// skyLightP += skyLightData.length;
// return;
//}
bool bHasLower, bHasUpper;
bHasLower = bHasUpper = false;
int lowerY0, lowerY1, upperY0, upperY1;

View File

@@ -58,7 +58,7 @@ private:
vector<shared_ptr<TileEntity> > m_tileEntities;
vector< pair<Vec3 *, CompoundTag *> > m_entities;
public:
public:
byteArray m_data;
public:
@@ -72,8 +72,8 @@ public:
void save(DataOutputStream *dos);
void load(DataInputStream *dis);
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
int64_t applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);

View File

@@ -14,7 +14,7 @@ public:
typedef struct _ValueType
{
union{
__int64 i64;
int64_t i64;
int i;
char c;
bool b;
@@ -44,7 +44,7 @@ public:
virtual ~GameRule();
Connection *getConnection() { return m_connection; }
ValueType getParameter(const wstring &parameterName);
void setParameter(const wstring &parameterName,ValueType value);
GameRuleDefinition *getGameRuleDefinition();

View File

@@ -77,7 +77,7 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
L"spawnY", // eGameRuleAttr_spawnY
L"spawnZ", // eGameRuleAttr_spawnZ
L"orientation",
L"dimension",
L"dimension",
L"topTileId", // eGameRuleAttr_topTileId
L"biomeId", // eGameRuleAttr_biomeId
L"feature", // eGameRuleAttr_feature
@@ -114,7 +114,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
//createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
dlcHeader->lgo = createdLevelGenerationOptions;
@@ -130,12 +130,12 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings);
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
//createdLevelGenerationOptions->set_DLCGameRulesFile( dlcFile );
createdLevelGenerationOptions->setLoadedData();
@@ -169,7 +169,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
app.DebugPrintf("\tversion=%d.\n", version);
for (int i = 0; i < 8; i++) dis.readByte();
BYTE compression_type = dis.readByte();
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
@@ -179,11 +179,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
decomp_len = dis.readInt();
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
// Decompress File Body
byteArray content(new BYTE[decomp_len], decomp_len),
byteArray content(new BYTE[decomp_len], decomp_len),
compr_content(new BYTE[compr_len], compr_len);
dis.read(compr_content);
@@ -256,7 +256,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
// Initialise output stream.
ByteArrayOutputStream baos;
DataOutputStream dos(&baos);
// Write header.
// VERSION NUMBER
@@ -284,7 +284,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
compr_dos.writeInt( 0 ); // XmlObjects.length
}
else
{
{
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
if (st == NULL)
@@ -316,9 +316,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
dos.writeInt( compr_ba.length ); // Write length
dos.writeInt( compr_baos.buf.length );
dos.write(compr_ba);
delete [] compr_ba.data;
compr_dos.close();
compr_baos.close();
// -- END COMPRESSED -- //
@@ -328,7 +328,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
*dOut = baos.buf.data;
baos.buf.data = NULL;
dos.close(); baos.close();
}
@@ -383,7 +383,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
//DWORD dwLen = 0;
//PBYTE pbData = dlcFile->getData(dwLen);
//byteArray data(pbData,dwLen);
byteArray data(dIn, dSize);
ByteArrayInputStream bais(data);
DataInputStream dis(&bais);
@@ -391,7 +391,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
// Read File.
// version_number
__int64 version = dis.readShort();
int64_t version = dis.readShort();
unsigned char compressionType = 0;
if(version == 0)
{
@@ -502,7 +502,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
}
}*/
// subfile
// subfile
UINT numFiles = contentDis->readInt();
for (UINT i = 0; i < numFiles; i++)
{
@@ -570,10 +570,10 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
{
LevelGenerationOptions *out =
LevelGenerationOptions *out =
new LevelGenerationOptions();
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
out->setGrSource(grh);
addLevelGenerationOptions(out);
@@ -733,7 +733,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
{
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
for (int i = 0; i<lgs->size(); i++)
if (lgs->at(i) == lgo)
return i;
@@ -753,7 +753,7 @@ void GameRuleManager::unloadCurrentGameRules()
if (m_currentLevelGenerationOptions->isFromSave())
{
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
delete m_currentLevelGenerationOptions;
}
else if (m_currentLevelGenerationOptions->isFromDLC())

View File

@@ -70,17 +70,17 @@ LevelGenerationOptions::~LevelGenerationOptions()
{
delete *it;
}
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
{
delete *it;
}
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
{
delete *it;
}
if (m_stringTable)
if (!isTutorial())
delete m_stringTable;
@@ -93,7 +93,7 @@ ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return
void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttrs)
{
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
dos->writeUTF(_toString(m_spawnPos->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
@@ -110,12 +110,12 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren(children);
vector<ApplySchematicRuleDefinition *> used_schematics;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
if ( !(*it)->isComplete() )
used_schematics.push_back( *it );
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
children->push_back( *it );
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
@@ -162,7 +162,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
{
if(attributeName.compare(L"seed") == 0)
{
m_seed = _fromString<__int64>(attributeValue);
m_seed = _fromString<int64_t>(attributeValue);
app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed);
}
else if(attributeName.compare(L"spawnX") == 0)
@@ -213,7 +213,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
}
else if(attributeName.compare(L"texturePackId") == 0)
{
{
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
setRequiresTexturePack( true );
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
@@ -290,14 +290,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
{
ConsoleGenerateStructure *structureStart = *it;
ConsoleGenerateStructure *structureStart = *it;
int minY = structureStart->getMinY();
if(minY < m_minY) m_minY = minY;
}
m_bHaveMinY = true;
}
// 4J Stu - We DO NOT intersect if our upper bound is below the lower bound for all schematics
if( y1 < m_minY ) return false;
@@ -313,7 +313,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
{
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
{
ConsoleGenerateStructure *structureStart = *it;
ConsoleGenerateStructure *structureStart = *it;
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break;
}
@@ -438,12 +438,12 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
usedFiles.insert( (*it)->getSchematicName() );
// Clean schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *out
unordered_map<wstring, ConsoleSchematicFile *> *out
= new unordered_map<wstring, ConsoleSchematicFile *>();
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
return out;
return out;
}
void LevelGenerationOptions::reset_start()
@@ -505,7 +505,7 @@ void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; }
int64_t LevelGenerationOptions::getLevelSeed() { return m_seed; }
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }

View File

@@ -19,7 +19,7 @@ class GrSource
public:
// 4J-JEV:
// Moved all this here; I didn't like that all this header information
// was being mixed in with all the game information as they have
// was being mixed in with all the game information as they have
// completely different lifespans.
virtual bool requiresTexturePack()=0;
@@ -146,7 +146,7 @@ public:
private:
// This should match the "MapOptionsRule" definition in the XML schema
__int64 m_seed;
int64_t m_seed;
bool m_useFlatWorld;
Pos *m_spawnPos;
vector<ApplySchematicRuleDefinition *> m_schematicRules;
@@ -167,13 +167,13 @@ public:
~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType();
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
virtual void getChildren(vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
__int64 getLevelSeed();
int64_t getLevelSeed();
Pos *getSpawnPos();
bool getuseFlatWorld();
@@ -185,7 +185,7 @@ public:
private:
void clearSchematics();
public:
public:
ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen);
public:
@@ -203,7 +203,7 @@ public:
LPCWSTR getString(const wstring &key);
unordered_map<wstring, ConsoleSchematicFile *> *getUnfinishedSchematicFiles();
// 4J-JEV:
// ApplySchematicRules contain limited state
// which needs to be reset BEFORE a new game starts.