From 92b23e515d5323138ada0954d69036156bc6cf4f Mon Sep 17 00:00:00 2001 From: garak Date: Thu, 8 Nov 2018 18:55:50 -0500 Subject: [PATCH] c define ignore nonexistent values (#56) --- src/project.cpp | 7 ++++--- src/ui/connectionpixmapitem.cpp | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/project.cpp b/src/project.cpp index 9ee2acab..7af5d5cd 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -1224,13 +1224,13 @@ QMap Project::getTilesets() { // Advance to command specifying whether or not it is a secondary tileset i += 2; if (commands->at(i).at(0) != ".byte") { - qDebug() << "Unexpected command found for secondary tileset flag in tileset" << tilesetLabel << ". Expected '.byte', but found: " << commands->at(i).at(0); + qDebug().nospace() << "Unexpected command found for secondary tileset flag in tileset" << tilesetLabel << ". Expected '.byte', but found: " << commands->at(i).at(0); continue; } QString secondaryTilesetValue = commands->at(i).at(1); if (secondaryTilesetValue != "TRUE" && secondaryTilesetValue != "FALSE" && secondaryTilesetValue != "0" && secondaryTilesetValue != "1") { - qDebug() << "Unexpected secondary tileset flag found. Expected \"TRUE\", \"FALSE\", \"0\", or \"1\", but found: " << secondaryTilesetValue; + qDebug().nospace() << "Unexpected secondary tileset flag found. Expected \"TRUE\", \"FALSE\", \"0\", or \"1\", but found: " << secondaryTilesetValue; continue; } @@ -1852,6 +1852,7 @@ QString Project::readCIncbin(QString text, QString label) { QMap Project::readCDefines(QString text, QStringList prefixes) { ParseUtil parser; + text.replace(QRegularExpression("//.*"), ""); QMap allDefines; QMap filteredDefines; QRegularExpression re("#define\\s+(?\\w+)[^\\S\\n]+(?.+)"); @@ -1860,7 +1861,7 @@ QMap Project::readCDefines(QString text, QStringList prefixes) { QRegularExpressionMatch match = iter.next(); QString name = match.captured("defineName"); QString expression = match.captured("defineValue"); - expression.replace(QRegularExpression("//.*"), ""); + if (expression == " ") continue; int value = parser.evaluateDefine(expression, &allDefines); allDefines.insert(name, value); for (QString prefix : prefixes) { diff --git a/src/ui/connectionpixmapitem.cpp b/src/ui/connectionpixmapitem.cpp index 5330fd9f..d6e50d20 100644 --- a/src/ui/connectionpixmapitem.cpp +++ b/src/ui/connectionpixmapitem.cpp @@ -1,4 +1,5 @@ #include "connectionpixmapitem.h" +#include void ConnectionPixmapItem::render(qreal opacity) { QPixmap newPixmap = this->basePixmap.copy(0, 0, this->basePixmap.width(), this->basePixmap.height());