From 3ca1ee1650792f297e23f1f1b86951340f40d587 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 28 Dec 2024 00:56:34 -0500 Subject: [PATCH] Remove config diff noise from hashed containers changing order --- include/config.h | 6 +++--- include/ui/projectsettingseditor.h | 2 +- src/config.cpp | 12 ++++++------ src/ui/projectsettingseditor.cpp | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/config.h b/include/config.h index 47bc2010..39ae4cdc 100644 --- a/include/config.h +++ b/include/config.h @@ -337,7 +337,7 @@ public: QString getEventIconPath(Event::Group group); void setPokemonIconPath(const QString &species, const QString &path); QString getPokemonIconPath(const QString &species); - QHash getPokemonIconPaths(); + QMap getPokemonIconPaths(); BaseGameVersion baseGameVersion; QString projectDir; @@ -374,7 +374,7 @@ public: QString collisionSheetPath; int collisionSheetWidth; int collisionSheetHeight; - QSet warpBehaviors; + QList warpBehaviors; protected: virtual QString getConfigFilepath() override; @@ -388,7 +388,7 @@ private: QMap identifiers; QMap filePaths; QMap eventIconPaths; - QHash pokemonIconPaths; + QMap pokemonIconPaths; }; extern ProjectConfig projectConfig; diff --git a/include/ui/projectsettingseditor.h b/include/ui/projectsettingseditor.h index a0a26982..e4a6ae94 100644 --- a/include/ui/projectsettingseditor.h +++ b/include/ui/projectsettingseditor.h @@ -36,7 +36,7 @@ private: bool projectNeedsReload = false; bool refreshing = false; const QString baseDir; - QHash editedPokemonIconPaths; + QMap editedPokemonIconPaths; QString prevIconSpecies; void initUi(); diff --git a/src/config.cpp b/src/config.cpp index c0c00194..da58ecde 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -16,7 +16,7 @@ #include #include -const QSet defaultWarpBehaviors_RSE = { +const QList defaultWarpBehaviors_RSE = { 0x0E, // MB_MOSSDEEP_GYM_WARP 0x0F, // MB_MT_PYRE_HOLE 0x1B, // MB_STAIRS_OUTSIDE_ABANDONED_SHIP @@ -47,7 +47,7 @@ const QSet defaultWarpBehaviors_RSE = { 0x9D, // MB_SECRET_BASE_SPOT_TREE_RIGHT_OPEN }; -const QSet defaultWarpBehaviors_FRLG = { +const QList defaultWarpBehaviors_FRLG = { 0x60, // MB_CAVE_DOOR 0x61, // MB_LADDER 0x62, // MB_EAST_ARROW_WARP @@ -773,9 +773,9 @@ void ProjectConfig::parseConfigKeyValue(QString key, QString value) { } else if (key == "warp_behaviors") { this->warpBehaviors.clear(); value.remove(" "); - QStringList behaviorList = value.split(",", Qt::SkipEmptyParts); + const QStringList behaviorList = value.split(",", Qt::SkipEmptyParts); for (auto s : behaviorList) - this->warpBehaviors.insert(getConfigUint32(key, s)); + this->warpBehaviors.append(getConfigUint32(key, s)); } else { logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key)); } @@ -864,7 +864,7 @@ QMap ProjectConfig::getKeyValueMap() { map.insert("collision_sheet_width", QString::number(this->collisionSheetWidth)); map.insert("collision_sheet_height", QString::number(this->collisionSheetHeight)); QStringList warpBehaviorStrs; - for (auto value : this->warpBehaviors) + for (const auto &value : this->warpBehaviors) warpBehaviorStrs.append("0x" + QString("%1").arg(value, 2, 16, QChar('0')).toUpper()); map.insert("warp_behaviors", warpBehaviorStrs.join(",")); @@ -1006,7 +1006,7 @@ QString ProjectConfig::getPokemonIconPath(const QString &species) { return this->pokemonIconPaths.value(species); } -QHash ProjectConfig::getPokemonIconPaths() { +QMap ProjectConfig::getPokemonIconPaths() { return this->pokemonIconPaths; } diff --git a/src/ui/projectsettingseditor.cpp b/src/ui/projectsettingseditor.cpp index 346591f4..2f5de651 100644 --- a/src/ui/projectsettingseditor.cpp +++ b/src/ui/projectsettingseditor.cpp @@ -475,7 +475,7 @@ void ProjectSettingsEditor::refresh() { // Set warp behaviors QStringList behaviorNames; - for (auto value : projectConfig.warpBehaviors) { + for (const auto &value : projectConfig.warpBehaviors) { if (project->metatileBehaviorMapInverse.contains(value)) behaviorNames.append(project->metatileBehaviorMapInverse.value(value)); } @@ -541,9 +541,9 @@ void ProjectSettingsEditor::save() { // Save warp behaviors projectConfig.warpBehaviors.clear(); - QStringList behaviorNames = this->getWarpBehaviorsList(); + const QStringList behaviorNames = this->getWarpBehaviorsList(); for (auto name : behaviorNames) - projectConfig.warpBehaviors.insert(project->metatileBehaviorMap.value(name)); + projectConfig.warpBehaviors.append(project->metatileBehaviorMap.value(name)); // Save border metatile IDs projectConfig.newMapBorderMetatileIds = this->getBorderMetatileIds(ui->checkBox_EnableCustomBorderSize->isChecked());