[FSD] Check attributes of full JSON parts

This commit is contained in:
Klaus Basan
2020-04-16 23:52:36 +02:00
committed by Mat Sutcliffe
parent 70c88f0982
commit 4d7468f913
3 changed files with 13 additions and 1 deletions

View File

@@ -191,6 +191,9 @@ namespace BlackMisc
//! Attribute name
static const QString &attributeNameIsFullJson();
//! Number of attributes for full JSON
static constexpr int attributesCountFullJson = 7;
private:
CAircraftLights m_lights;
CAircraftEngineList m_engines;

View File

@@ -422,6 +422,13 @@ namespace BlackMisc
{
if (isFull)
{
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
// validation in dev.env.
const int attributes = jsonObject.size();
const bool correctCount = (attributes == CAircraftParts::attributesCountFullJson);
BLACK_VERIFY_X(correctCount, Q_FUNC_INFO, "Wrong full aircraft parts");
}
parts.convertFromJson(jsonObject);
}
else