Skip to content

Commit

Permalink
Remove config diff noise from hashed containers changing order
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Dec 28, 2024
1 parent 9efbe53 commit 3ca1ee1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class ProjectConfig: public KeyValueConfigBase
QString getEventIconPath(Event::Group group);
void setPokemonIconPath(const QString &species, const QString &path);
QString getPokemonIconPath(const QString &species);
QHash<QString, QString> getPokemonIconPaths();
QMap<QString, QString> getPokemonIconPaths();

BaseGameVersion baseGameVersion;
QString projectDir;
Expand Down Expand Up @@ -374,7 +374,7 @@ class ProjectConfig: public KeyValueConfigBase
QString collisionSheetPath;
int collisionSheetWidth;
int collisionSheetHeight;
QSet<uint32_t> warpBehaviors;
QList<uint32_t> warpBehaviors;

protected:
virtual QString getConfigFilepath() override;
Expand All @@ -388,7 +388,7 @@ class ProjectConfig: public KeyValueConfigBase
QMap<ProjectIdentifier, QString> identifiers;
QMap<ProjectFilePath, QString> filePaths;
QMap<Event::Group, QString> eventIconPaths;
QHash<QString, QString> pokemonIconPaths;
QMap<QString, QString> pokemonIconPaths;
};

extern ProjectConfig projectConfig;
Expand Down
2 changes: 1 addition & 1 deletion include/ui/projectsettingseditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ProjectSettingsEditor : public QMainWindow
bool projectNeedsReload = false;
bool refreshing = false;
const QString baseDir;
QHash<QString, QString> editedPokemonIconPaths;
QMap<QString, QString> editedPokemonIconPaths;
QString prevIconSpecies;

void initUi();
Expand Down
12 changes: 6 additions & 6 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <QAction>
#include <QAbstractButton>

const QSet<uint32_t> defaultWarpBehaviors_RSE = {
const QList<uint32_t> defaultWarpBehaviors_RSE = {
0x0E, // MB_MOSSDEEP_GYM_WARP
0x0F, // MB_MT_PYRE_HOLE
0x1B, // MB_STAIRS_OUTSIDE_ABANDONED_SHIP
Expand Down Expand Up @@ -47,7 +47,7 @@ const QSet<uint32_t> defaultWarpBehaviors_RSE = {
0x9D, // MB_SECRET_BASE_SPOT_TREE_RIGHT_OPEN
};

const QSet<uint32_t> defaultWarpBehaviors_FRLG = {
const QList<uint32_t> defaultWarpBehaviors_FRLG = {
0x60, // MB_CAVE_DOOR
0x61, // MB_LADDER
0x62, // MB_EAST_ARROW_WARP
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -864,7 +864,7 @@ QMap<QString, QString> 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(","));

Expand Down Expand Up @@ -1006,7 +1006,7 @@ QString ProjectConfig::getPokemonIconPath(const QString &species) {
return this->pokemonIconPaths.value(species);
}

QHash<QString, QString> ProjectConfig::getPokemonIconPaths() {
QMap<QString, QString> ProjectConfig::getPokemonIconPaths() {
return this->pokemonIconPaths;
}

Expand Down
6 changes: 3 additions & 3 deletions src/ui/projectsettingseditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 3ca1ee1

Please sign in to comment.