mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-25 01:56:34 -05:00
Validate region map sections
This commit is contained in:
@@ -130,7 +130,7 @@ public:
|
||||
QStringList getVisibilities();
|
||||
QMap<QString, QStringList> getTilesetLabels();
|
||||
void readTilesetProperties();
|
||||
void readRegionMapSections();
|
||||
bool readRegionMapSections();
|
||||
void readItemNames();
|
||||
void readFlagNames();
|
||||
void readVarNames();
|
||||
|
||||
@@ -597,11 +597,11 @@ void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
|
||||
|
||||
bool MainWindow::loadDataStructures() {
|
||||
Project *project = editor->project;
|
||||
bool success = project->readMapLayouts();
|
||||
bool success = project->readMapLayouts()
|
||||
&& project->readRegionMapSections();
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
project->readRegionMapSections();
|
||||
project->readItemNames();
|
||||
project->readFlagNames();
|
||||
project->readVarNames();
|
||||
|
||||
@@ -1728,15 +1728,22 @@ void Project::readTilesetProperties() {
|
||||
}
|
||||
}
|
||||
|
||||
void Project::readRegionMapSections() {
|
||||
bool Project::readRegionMapSections() {
|
||||
this->mapSectionNameToValue.clear();
|
||||
this->mapSectionValueToName.clear();
|
||||
|
||||
QStringList prefixes = (QStringList() << "MAPSEC_");
|
||||
this->mapSectionNameToValue = parser.readCDefines("include/constants/region_map_sections.h", prefixes);
|
||||
QString filename = "include/constants/region_map_sections.h";
|
||||
this->mapSectionNameToValue = parser.readCDefines(filename, prefixes);
|
||||
if (this->mapSectionNameToValue.isEmpty()) {
|
||||
logError(QString("Failed to read region map sections from %1.").arg(filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (QString defineName : this->mapSectionNameToValue.keys()) {
|
||||
this->mapSectionValueToName.insert(this->mapSectionNameToValue[defineName], defineName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::readHealLocations() {
|
||||
|
||||
Reference in New Issue
Block a user