Remove AUTO_VAR macro and _toString function (#592)

This commit is contained in:
void_17
2026-03-06 02:11:18 +07:00
committed by GitHub
parent 7d6658fe5b
commit 55231bb8d3
294 changed files with 5067 additions and 5773 deletions

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
@@ -127,7 +127,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
// = loadGameRules(dData, dSize); //, strings);
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
@@ -164,7 +164,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);
@@ -174,11 +174,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);
@@ -251,7 +251,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
// Initialise output stream.
ByteArrayOutputStream baos;
DataOutputStream dos(&baos);
// Write header.
// VERSION NUMBER
@@ -279,7 +279,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
compr_dos.writeInt( 0 ); // XmlObjects.length
}
else
{
{
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
if (st == NULL)
@@ -311,9 +311,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 -- //
@@ -323,7 +323,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
*dOut = baos.buf.data;
baos.buf.data = NULL;
dos.close(); baos.close();
}
@@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
// Write schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *files;
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
dos->writeInt( files->size() );
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
for ( auto& it : *files )
{
wstring filename = it->first;
ConsoleSchematicFile *file = it->second;
const wstring& filename = it.first;
ConsoleSchematicFile *file = it.second;
ByteArrayOutputStream fileBaos;
DataOutputStream fileDos(&fileBaos);
@@ -378,7 +377,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);
@@ -497,7 +496,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
}
}*/
// subfile
// subfile
UINT numFiles = contentDis->readInt();
for (UINT i = 0; i < numFiles; i++)
{
@@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{
int tagId = contentDis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap.find(tagId));
auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second;
GameRuleDefinition *rule = NULL;
@@ -565,10 +564,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);
@@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
{
int tagId = dis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap->find(tagId));
auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second;
GameRuleDefinition *childRule = NULL;
@@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
#ifndef _CONTENT_PACKAGE
// 4J Stu - Remove these just now
//File testRulesPath(L"GAME:\\GameRules");
//vector<File *> *packFiles = testRulesPath.listFiles();
//for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it)
//{
// loadGameRulesPack(*it);
//}
//delete packFiles;
#endif
#else // _XBOX
#ifdef _WINDOWS64
@@ -741,7 +728,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;
@@ -761,7 +748,7 @@ void GameRuleManager::unloadCurrentGameRules()
if (m_currentLevelGenerationOptions->isFromSave())
{
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
delete m_currentLevelGenerationOptions;
}
else if (m_currentLevelGenerationOptions->isFromDLC())