Silence errors about SECRET_BASE_GROUP

This commit is contained in:
GriffinR 2022-09-12 11:54:44 -04:00
parent 856624addf
commit 7777eac9f4

View file

@ -2218,10 +2218,15 @@ bool Project::readSecretBaseIds() {
if (!projectConfig.getEventSecretBaseEnabled())
return true;
// SECRET_BASE_GROUP is a function-like macro, which Porymap can't handle.
// Redefine it so Porymap won't produce spurious errors about failing to parse it.
QMap<QString, int> knownDefines = QMap<QString, int>();
knownDefines.insert("SECRET_BASE_GROUP", 0);
QStringList prefixes("\\bSECRET_BASE_[A-Za-z0-9_]*_[0-9]+");
QString filename = "include/constants/secret_bases.h";
fileWatcher.addPath(root + "/" + filename);
secretBaseIds = parser.readCDefinesSorted(filename, prefixes);
secretBaseIds = parser.readCDefinesSorted(filename, prefixes, knownDefines);
if (secretBaseIds.isEmpty()) {
logError(QString("Failed to read secret base id constants from %1").arg(filename));
return false;