mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 08:55:37 -05:00
Merge pull request #802 from TixoRebel/region_map_config
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
Add config option for region map sections json key
This commit is contained in:
@@ -66,6 +66,7 @@ enum ProjectIdentifier {
|
||||
regex_incbin,
|
||||
pals_output_extension,
|
||||
tiles_output_extension,
|
||||
key_region_map_sections,
|
||||
};
|
||||
|
||||
enum ProjectFilePath {
|
||||
|
||||
@@ -71,6 +71,8 @@ const QMap<ProjectIdentifier, QString> ProjectConfig::defaultIdentifiers = {
|
||||
{ProjectIdentifier::regex_encounter_types, "\\bTILE_ENCOUNTER_"},
|
||||
{ProjectIdentifier::regex_terrain_types, "\\bTILE_TERRAIN_"},
|
||||
{ProjectIdentifier::regex_incbin, Regex::Pattern_INCBIN},
|
||||
// JSON keys
|
||||
{ProjectIdentifier::key_region_map_sections, "map_sections"},
|
||||
// Other
|
||||
{ProjectIdentifier::pals_output_extension, ".gbapal"},
|
||||
{ProjectIdentifier::tiles_output_extension, ".4bpp.lz"},
|
||||
|
||||
@@ -983,8 +983,10 @@ bool Project::saveRegionMapSections() {
|
||||
mapSectionArray.append(mapSectionObj);
|
||||
}
|
||||
|
||||
const QString mapSectionsKey = projectConfig.getIdentifier(ProjectIdentifier::key_region_map_sections);
|
||||
|
||||
OrderedJson::object object;
|
||||
object["map_sections"] = mapSectionArray;
|
||||
object[mapSectionsKey] = mapSectionArray;
|
||||
OrderedJson::append(&object, this->customMapSectionsData);
|
||||
|
||||
ignoreWatchedFileTemporarily(filepath);
|
||||
@@ -2549,8 +2551,10 @@ bool Project::readRegionMapSections() {
|
||||
}
|
||||
watchFile(filepath);
|
||||
|
||||
const QString mapSectionsKey = projectConfig.getIdentifier(ProjectIdentifier::key_region_map_sections);
|
||||
|
||||
QJsonObject mapSectionsGlobalObj = doc.object();
|
||||
QJsonArray mapSections = mapSectionsGlobalObj.take("map_sections").toArray();
|
||||
QJsonArray mapSections = mapSectionsGlobalObj.take(mapSectionsKey).toArray();
|
||||
for (int i = 0; i < mapSections.size(); i++) {
|
||||
QJsonObject mapSectionObj = mapSections.at(i).toObject();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user