Restore Project::defaultSong

This commit is contained in:
GriffinR 2024-01-19 15:18:14 -05:00
parent 3ebc7a93d4
commit 42a95b32a2
3 changed files with 4 additions and 1 deletions

View file

@ -54,6 +54,7 @@ public:
QMap<int, QString> mapSectionValueToName;
QMap<QString, EventGraphics*> eventGraphicsMap;
QMap<QString, int> gfxDefines;
QString defaultSong;
QStringList songNames;
QStringList itemNames;
QStringList flagNames;

View file

@ -2339,6 +2339,8 @@ bool Project::readSongNames() {
logWarn(QString("Failed to read song names from %1.").arg(filename));
// Song names don't have a very useful order (esp. if we include SE_* values), so sort them alphabetically.
// The default song should be the first in the list, not the first alphabetically, so save that before sorting.
this->defaultSong = this->songNames.value(0, "0");
this->songNames.sort();
return true;
}

View file

@ -175,7 +175,7 @@ void NewMapPopup::setDefaultSettings(Project *project) {
settings.secondaryTilesetLabel = project->getDefaultSecondaryTilesetLabel();
settings.type = project->mapTypes.value(0, "0");
settings.location = project->mapSectionNameToValue.keys().value(0, "0");
settings.song = project->songNames.value(0, "0");
settings.song = project->defaultSong;
settings.canFlyTo = false;
settings.showLocationName = true;
settings.allowRunning = false;