refactor: expand AUTO_VAR macro

This commit is contained in:
Tropical
2026-03-29 23:59:05 -05:00
parent a330ecdcbb
commit e45151ae64
201 changed files with 1051 additions and 1055 deletions

View File

@@ -74,21 +74,21 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
LevelGenerationOptions::~LevelGenerationOptions() {
clearSchematics();
if (m_spawnPos != NULL) delete m_spawnPos;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
delete *it;
}
for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end();
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
++it) {
delete *it;
}
for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end();
for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end();
++it) {
delete *it;
}
for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) {
for (auto it = m_features.begin(); it != m_features.end(); ++it) {
delete *it;
}
@@ -124,20 +124,20 @@ void LevelGenerationOptions::getChildren(
GameRuleDefinition::getChildren(children);
std::vector<ApplySchematicRuleDefinition*> used_schematics;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto 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();
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
it++)
children->push_back(*it);
for (AUTO_VAR(it, used_schematics.begin()); it != used_schematics.end();
for (auto it = used_schematics.begin(); it != used_schematics.end();
it++)
children->push_back(*it);
for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end();
for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end();
++it)
children->push_back(*it);
for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
for (auto it = m_features.begin(); it != m_features.end(); ++it)
children->push_back(*it);
}
@@ -255,7 +255,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
chunk->z);
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
Level::maxBuildHeight, chunk->z * 16 + 16);
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
ApplySchematicRuleDefinition* rule = *it;
rule->processSchematic(&chunkBox, chunk);
@@ -264,7 +264,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
int cx = (chunk->x << 4);
int cz = (chunk->z << 4);
for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end();
for (auto it = m_structureRules.begin(); it != m_structureRules.end();
it++) {
ConsoleGenerateStructure* structureStart = *it;
@@ -283,7 +283,7 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) {
chunk->x, chunk->z);
AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16,
Level::maxBuildHeight, chunk->z * 16 + 16);
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
ApplySchematicRuleDefinition* rule = *it;
rule->processSchematicLighting(&chunkBox, chunk);
@@ -300,14 +300,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
// ground/sea level and b) tutorial world additions generally being above
// ground/sea level
if (!m_bHaveMinY) {
for (AUTO_VAR(it, m_schematicRules.begin());
for (auto it = m_schematicRules.begin();
it != m_schematicRules.end(); ++it) {
ApplySchematicRuleDefinition* rule = *it;
int minY = rule->getMinY();
if (minY < m_minY) m_minY = minY;
}
for (AUTO_VAR(it, m_structureRules.begin());
for (auto it = m_structureRules.begin();
it != m_structureRules.end(); it++) {
ConsoleGenerateStructure* structureStart = *it;
int minY = structureStart->getMinY();
@@ -322,7 +322,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
if (y1 < m_minY) return false;
bool intersects = false;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
ApplySchematicRuleDefinition* rule = *it;
intersects = rule->checkIntersects(x0, y0, z0, x1, y1, z1);
@@ -330,7 +330,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
}
if (!intersects) {
for (AUTO_VAR(it, m_structureRules.begin());
for (auto it = m_structureRules.begin();
it != m_structureRules.end(); it++) {
ConsoleGenerateStructure* structureStart = *it;
intersects =
@@ -343,7 +343,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1,
}
void LevelGenerationOptions::clearSchematics() {
for (AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it) {
for (auto it = m_schematics.begin(); it != m_schematics.end(); ++it) {
delete it->second;
}
m_schematics.clear();
@@ -353,7 +353,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
const std::wstring& filename, std::uint8_t* pbData,
unsigned int dataLength) {
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if (it != m_schematics.end()) {
#if !defined(_CONTENT_PACKAGE)
wprintf(L"We have already loaded schematic file %ls\n",
@@ -378,7 +378,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
const std::wstring& filename) {
ConsoleSchematicFile* schematic = NULL;
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if (it != m_schematics.end()) {
schematic = it->second;
}
@@ -389,7 +389,7 @@ void LevelGenerationOptions::releaseSchematicFile(
const std::wstring& filename) {
// 4J Stu - We don't want to delete them when done, but probably want to
// keep a set of active schematics for the current world
// AUTO_VAR(it, m_schematics.find(filename));
// auto it = m_schematics.find(filename);
// if(it != m_schematics.end())
//{
// ConsoleSchematicFile *schematic = it->second;
@@ -416,7 +416,7 @@ const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) {
void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t& tile,
std::uint8_t& topTile) {
for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end();
for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end();
++it) {
BiomeOverride* bo = *it;
if (bo->isBiome(biomeId)) {
@@ -431,7 +431,7 @@ bool LevelGenerationOptions::isFeatureChunk(
int* orientation) {
bool isFeature = false;
for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) {
for (auto it = m_features.begin(); it != m_features.end(); ++it) {
StartFeature* sf = *it;
if (sf->isFeatureChunk(chunkX, chunkZ, feature, orientation)) {
isFeature = true;
@@ -446,14 +446,14 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() {
// Clean schematic rules.
std::unordered_set<std::wstring> usedFiles =
std::unordered_set<std::wstring>();
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
it++)
if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName());
// Clean schematic files.
std::unordered_map<std::wstring, ConsoleSchematicFile*>* out =
new std::unordered_map<std::wstring, ConsoleSchematicFile*>();
for (AUTO_VAR(it, usedFiles.begin()); it != usedFiles.end(); it++)
for (auto it = usedFiles.begin(); it != usedFiles.end(); it++)
out->insert(std::pair<std::wstring, ConsoleSchematicFile*>(
*it, getSchematicFile(*it)));
@@ -624,7 +624,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam, int iPad, DWORD dwErr,
}
void LevelGenerationOptions::reset_start() {
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
it++) {
(*it)->reset();
}