From a15daf6c1498b4794b71e6b7c856ec324c6b7e6c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 7 May 2025 12:27:42 -0400 Subject: [PATCH] Relax remaining MAP_ prefix assumptions --- docsrc/manual/project-files.rst | 8 ++++---- src/config.cpp | 4 ++-- src/project.cpp | 13 +++---------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/docsrc/manual/project-files.rst b/docsrc/manual/project-files.rst index 93715d86..27188387 100644 --- a/docsrc/manual/project-files.rst +++ b/docsrc/manual/project-files.rst @@ -110,10 +110,10 @@ In addition to these files, there are some specific symbol and macro names that ``define_attribute_encounter``, ``METATILE_ATTRIBUTE_ENCOUNTER_TYPE``, name used to extract setting from ``symbol_attribute_table`` ``define_metatile_label_prefix``, ``METATILE_``, expected prefix for metatile label macro names ``define_heal_locations_prefix``, ``HEAL_LOCATION_``, default prefix for heal location macro names - ``define_layout_prefix``, ``LAYOUT_``, default prefix for layout macro names - ``define_map_prefix``, ``MAP_``, expected prefix for map macro names - ``define_map_dynamic``, ``DYNAMIC``, macro name after prefix for Dynamic maps - ``define_map_empty``, ``UNDEFINED``, macro name after prefix for empty maps + ``define_layout_prefix``, ``LAYOUT_``, default prefix for layout ID names + ``define_map_prefix``, ``MAP_``, default prefix for map ID names + ``define_map_dynamic``, ``MAP_DYNAMIC``, ID name for Dynamic maps + ``define_map_empty``, ``MAP_UNDEFINED``, ID name for empty maps ``define_map_section_prefix``, ``MAPSEC_``, expected prefix for location macro names ``define_map_section_empty``, ``NONE``, macro name after prefix for empty region map sections ``define_species_prefix``, ``SPECIES_``, expected prefix for species macro names diff --git a/src/config.cpp b/src/config.cpp index 7914cdce..43cc427c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -110,8 +110,8 @@ const QMap> ProjectConfig::defaultIde {ProjectIdentifier::define_heal_locations_prefix, {"define_heal_locations_prefix", "HEAL_LOCATION_"}}, {ProjectIdentifier::define_layout_prefix, {"define_layout_prefix", "LAYOUT_"}}, {ProjectIdentifier::define_map_prefix, {"define_map_prefix", "MAP_"}}, - {ProjectIdentifier::define_map_dynamic, {"define_map_dynamic", "DYNAMIC"}}, - {ProjectIdentifier::define_map_empty, {"define_map_empty", "UNDEFINED"}}, + {ProjectIdentifier::define_map_dynamic, {"define_map_dynamic", "MAP_DYNAMIC"}}, + {ProjectIdentifier::define_map_empty, {"define_map_empty", "MAP_UNDEFINED"}}, {ProjectIdentifier::define_map_section_prefix, {"define_map_section_prefix", "MAPSEC_"}}, {ProjectIdentifier::define_map_section_empty, {"define_map_section_empty", "NONE"}}, {ProjectIdentifier::define_species_prefix, {"define_species_prefix", "SPECIES_"}}, diff --git a/src/project.cpp b/src/project.cpp index ab22de36..ec2a8a6f 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -974,14 +974,7 @@ bool Project::saveWildMonData() { // Because of how event ID names are checked it doesn't guarantee that the name // won't be in-use by some map that hasn't been loaded yet. QString Project::getNewHealLocationName(const Map* map) const { - if (!map) return QString(); - - QString idName = map->constantName(); - const QString mapPrefix = projectConfig.getIdentifier(ProjectIdentifier::define_map_prefix); - if (idName.startsWith(mapPrefix)) { - idName.remove(0, mapPrefix.length()); - } - return toUniqueIdentifier(projectConfig.getIdentifier(ProjectIdentifier::define_heal_locations_prefix) + idName); + return !map ? QString() : toUniqueIdentifier(projectConfig.getIdentifier(ProjectIdentifier::define_heal_locations_prefix) + Util::toDefineCase(map->name())); } bool Project::saveHealLocations() { @@ -3380,11 +3373,11 @@ int Project::getMaxEvents(Event::Group group) const { } QString Project::getEmptyMapDefineName() { - return projectConfig.getIdentifier(ProjectIdentifier::define_map_prefix) + projectConfig.getIdentifier(ProjectIdentifier::define_map_empty); + return projectConfig.getIdentifier(ProjectIdentifier::define_map_empty); } QString Project::getDynamicMapDefineName() { - return projectConfig.getIdentifier(ProjectIdentifier::define_map_prefix) + projectConfig.getIdentifier(ProjectIdentifier::define_map_dynamic); + return projectConfig.getIdentifier(ProjectIdentifier::define_map_dynamic); } QString Project::getDynamicMapName() {