Validate region map sections
This commit is contained in:
parent
79c74b8814
commit
a152404ce8
3 changed files with 12 additions and 5 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue