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();
|
QStringList getVisibilities();
|
||||||
QMap<QString, QStringList> getTilesetLabels();
|
QMap<QString, QStringList> getTilesetLabels();
|
||||||
void readTilesetProperties();
|
void readTilesetProperties();
|
||||||
void readRegionMapSections();
|
bool readRegionMapSections();
|
||||||
void readItemNames();
|
void readItemNames();
|
||||||
void readFlagNames();
|
void readFlagNames();
|
||||||
void readVarNames();
|
void readVarNames();
|
||||||
|
|
|
@ -597,11 +597,11 @@ void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
|
||||||
|
|
||||||
bool MainWindow::loadDataStructures() {
|
bool MainWindow::loadDataStructures() {
|
||||||
Project *project = editor->project;
|
Project *project = editor->project;
|
||||||
bool success = project->readMapLayouts();
|
bool success = project->readMapLayouts()
|
||||||
|
&& project->readRegionMapSections();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
project->readRegionMapSections();
|
|
||||||
project->readItemNames();
|
project->readItemNames();
|
||||||
project->readFlagNames();
|
project->readFlagNames();
|
||||||
project->readVarNames();
|
project->readVarNames();
|
||||||
|
|
|
@ -1728,15 +1728,22 @@ void Project::readTilesetProperties() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readRegionMapSections() {
|
bool Project::readRegionMapSections() {
|
||||||
this->mapSectionNameToValue.clear();
|
this->mapSectionNameToValue.clear();
|
||||||
this->mapSectionValueToName.clear();
|
this->mapSectionValueToName.clear();
|
||||||
|
|
||||||
QStringList prefixes = (QStringList() << "MAPSEC_");
|
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()) {
|
for (QString defineName : this->mapSectionNameToValue.keys()) {
|
||||||
this->mapSectionValueToName.insert(this->mapSectionNameToValue[defineName], defineName);
|
this->mapSectionValueToName.insert(this->mapSectionNameToValue[defineName], defineName);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readHealLocations() {
|
void Project::readHealLocations() {
|
||||||
|
|
Loading…
Reference in a new issue