Parse errors in CAircraftModelLoaderXPlane should be errors, not warnings.

This commit is contained in:
Mat Sutcliffe
2018-12-16 20:44:38 +00:00
parent 228ab8602c
commit 268d858e2d

View File

@@ -316,7 +316,7 @@ namespace BlackMisc
{ {
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': EXPORT_NAME command requires 1 argument.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': EXPORT_NAME command requires 1 argument.") << path << lineNum;
return false; return false;
} }
@@ -329,7 +329,7 @@ namespace BlackMisc
} }
else else
{ {
CLogMessage(this).warning("XPlane package name '%1' already in use by '%2' reqested by use by '%3'") << tokens[1] << p->path << path; CLogMessage(this).error("XPlane package name '%1' already in use by '%2' reqested by use by '%3'") << tokens[1] << p->path << path;
return false; return false;
} }
} }
@@ -339,13 +339,13 @@ namespace BlackMisc
Q_UNUSED(package); Q_UNUSED(package);
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("'%1' - '%2': DEPENDENCY command requires 1 argument.") << path << lineNum; CLogMessage(this).error("'%1' - '%2': DEPENDENCY command requires 1 argument.") << path << lineNum;
return false; return false;
} }
if (std::count_if(m_cslPackages.cbegin(), m_cslPackages.cend(), [&tokens](const CSLPackage & p) { return p.name == tokens[1]; }) == 0) if (std::count_if(m_cslPackages.cbegin(), m_cslPackages.cend(), [&tokens](const CSLPackage & p) { return p.name == tokens[1]; }) == 0)
{ {
CLogMessage(this).warning("XPlane required package %1 not found. Aborting processing of this package.") << tokens[1]; CLogMessage(this).error("XPlane required package %1 not found. Aborting processing of this package.") << tokens[1];
return false; return false;
} }
@@ -369,7 +369,7 @@ namespace BlackMisc
{ {
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': OBJECT command requires 1 argument.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': OBJECT command requires 1 argument.") << path << lineNum;
return false; return false;
} }
@@ -378,7 +378,7 @@ namespace BlackMisc
QString fullPath(relativePath); QString fullPath(relativePath);
if (!doPackageSub(fullPath)) if (!doPackageSub(fullPath))
{ {
CLogMessage(this).warning("XPlane '%1' - '%2: package not found.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2: package not found.") << path << lineNum;
return false; return false;
} }
@@ -386,7 +386,7 @@ namespace BlackMisc
QFile objFile(fullPath); QFile objFile(fullPath);
if (!objFile.open(QIODevice::ReadOnly | QIODevice::Text)) if (!objFile.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
CLogMessage(this).warning("XPlane object '%1' does not exist.") << fullPath; CLogMessage(this).error("XPlane object '%1' does not exist.") << fullPath;
return false; return false;
} }
QTextStream ts(&objFile); QTextStream ts(&objFile);
@@ -432,7 +432,7 @@ namespace BlackMisc
{ {
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': TEXTURE command requires 1 argument.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': TEXTURE command requires 1 argument.") << path << lineNum;
return false; return false;
} }
@@ -443,14 +443,14 @@ namespace BlackMisc
if (!doPackageSub(absoluteTexPath)) if (!doPackageSub(absoluteTexPath))
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': package not found.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': package not found.") << path << lineNum;
return false; return false;
} }
QFileInfo fileInfo(absoluteTexPath); QFileInfo fileInfo(absoluteTexPath);
if (!fileInfo.exists()) if (!fileInfo.exists())
{ {
CLogMessage(this).warning("XPlane texture '%1' does not exist.") << absoluteTexPath; CLogMessage(this).error("XPlane texture '%1' does not exist.") << absoluteTexPath;
return false; return false;
} }
@@ -464,7 +464,7 @@ namespace BlackMisc
// AIRCAFT <min> <max> <path> // AIRCAFT <min> <max> <path>
if (tokens.size() != 4) if (tokens.size() != 4)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': AIRCRAFT command requires 3 arguments.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': AIRCRAFT command requires 3 arguments.") << path << lineNum;
} }
// Flyable aircrafts are parsed by a different method. We don't know any aircraft files in CSL packages. // Flyable aircrafts are parsed by a different method. We don't know any aircraft files in CSL packages.
@@ -478,7 +478,7 @@ namespace BlackMisc
// OBJ8_AIRCRAFT <path> // OBJ8_AIRCRAFT <path>
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': OBJ8_AIRCARFT command requires 1 argument.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': OBJ8_AIRCARFT command requires 1 argument.") << path << lineNum;
} }
package.planes.push_back(CSLPlane()); package.planes.push_back(CSLPlane());
@@ -490,7 +490,7 @@ namespace BlackMisc
// OBJ8 <group> <animate YES|NO> <filename> {<texture filename> {<lit texture filename>}} // OBJ8 <group> <animate YES|NO> <filename> {<texture filename> {<lit texture filename>}}
if (tokens.size() < 4 || tokens.size() > 6) if (tokens.size() < 4 || tokens.size() > 6)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': OBJ8 command takes 3-5 arguments.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': OBJ8 command takes 3-5 arguments.") << path << lineNum;
} }
if (tokens[1] != "SOLID") { return true; } if (tokens[1] != "SOLID") { return true; }
@@ -500,7 +500,7 @@ namespace BlackMisc
QString fullPath(relativePath); QString fullPath(relativePath);
if (!doPackageSub(fullPath)) if (!doPackageSub(fullPath))
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': package not found.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': package not found.") << path << lineNum;
return false; return false;
} }
@@ -529,14 +529,14 @@ namespace BlackMisc
if (!doPackageSub(absoluteTexPath)) if (!doPackageSub(absoluteTexPath))
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': package not found.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': package not found.") << path << lineNum;
return false; return false;
} }
QFileInfo fileInfo(absoluteTexPath); QFileInfo fileInfo(absoluteTexPath);
if (!fileInfo.exists()) if (!fileInfo.exists())
{ {
CLogMessage(this).warning("XPlane texture '%1' does not exist.") << absoluteTexPath; CLogMessage(this).error("XPlane texture '%1' does not exist.") << absoluteTexPath;
return false; return false;
} }
@@ -559,7 +559,7 @@ namespace BlackMisc
// ICAO <code> // ICAO <code>
if (tokens.size() != 2) if (tokens.size() != 2)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': ICAO command requires 1 argument.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': ICAO command requires 1 argument.") << path << lineNum;
return false; return false;
} }
@@ -573,7 +573,7 @@ namespace BlackMisc
// AIRLINE <code> <airline> // AIRLINE <code> <airline>
if (tokens.size() != 3) if (tokens.size() != 3)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': AIRLINE command requires 2 arguments.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': AIRLINE command requires 2 arguments.") << path << lineNum;
return false; return false;
} }
@@ -589,7 +589,7 @@ namespace BlackMisc
// LIVERY <code> <airline> <livery> // LIVERY <code> <airline> <livery>
if (tokens.size() != 4) if (tokens.size() != 4)
{ {
CLogMessage(this).warning("XPlane '%1' - '%2': LIVERY command requires 3 arguments.") << path << lineNum; CLogMessage(this).error("XPlane '%1' - '%2': LIVERY command requires 3 arguments.") << path << lineNum;
return false; return false;
} }