Migrates remaining services and plugins to generated rtiddsgen API
Converts accessor calls to plain member access across the residual service set.
This commit is contained in:
104 files changed
+2424
-2430
No files matched your search
+48
-40
@@ -65,7 +65,7 @@ void DtcImplCustom::fillChargeTypeIgniterTypeIgniterFunctionProps()
|
||||
props.chargeTypeId = ctitif.chargeTypeId;
|
||||
props.igniterTypeId = ctitif.igniterTypeId;
|
||||
props.igniterFunctionId = ctitif.igniterFunctionId;
|
||||
props.igniterFunctionBase = ctitif.igniterFunctionBase;
|
||||
props.igniterFunctionBase = ctitif.igniterFunctionBaseId;
|
||||
props.impactRadius = ctitif.impactRadius;
|
||||
props.hazardDistance = ctitif.hazardDistance;
|
||||
props.chargeLegacyId = ctitif.chargeLegacyId;
|
||||
@@ -210,16 +210,16 @@ void DtcImplCustom::mergeProperties(QHash<int, ChargeTypeIgniterTypeIgniterFunct
|
||||
|
||||
void DtcImplCustom::onChargeTypeChanged(const ChargeType &ct)
|
||||
{
|
||||
if (ct.id() <= 0)
|
||||
if (ct.id <= 0)
|
||||
return;
|
||||
|
||||
QHash<int, ChargeTypeIgniterTypeIgniterFunctionProps>::iterator it;
|
||||
for (it = m_ctItIfProps.begin(); it != m_ctItIfProps.end(); ++it)
|
||||
{
|
||||
if (it->chargeTypeId != ct.id())
|
||||
if (it->chargeTypeId != ct.id)
|
||||
continue;
|
||||
|
||||
QJsonObject ctProps = propertiesToJson(ct.properties());
|
||||
QJsonObject ctProps = propertiesToJson(ct.properties);
|
||||
QJsonObject itProps = propertiesToJson(igniterType(it->igniterTypeId).properties);
|
||||
QJsonObject ifProps = propertiesToJson(igniterFunction(it->igniterFunctionId).properties);
|
||||
QJsonObject ctitifProps = propertiesToJson(chargeTypeIgniterTypeIgniterFunction(it.key()).properties);
|
||||
@@ -242,7 +242,7 @@ void DtcImplCustom::onChargeTypeIgniterTypeIgniterFunctionChanged(const ChargeTy
|
||||
it->chargeTypeId = ctitif.chargeTypeId;
|
||||
it->igniterTypeId = ctitif.igniterTypeId;
|
||||
it->igniterFunctionId = ctitif.igniterFunctionId;
|
||||
it->igniterFunctionBase = ctitif.igniterFunctionBase;
|
||||
it->igniterFunctionBase = ctitif.igniterFunctionBaseId;
|
||||
it->impactRadius = ctitif.impactRadius;
|
||||
it->hazardDistance = ctitif.hazardDistance;
|
||||
it->chargeLegacyId = ctitif.chargeLegacyId;
|
||||
@@ -257,9 +257,9 @@ void DtcImplCustom::onChargeTypeIgniterTypeIgniterFunctionChanged(const ChargeTy
|
||||
}
|
||||
}
|
||||
|
||||
QVector<ProjectDataManagement::ChargeTypeData> DtcImplCustom::chargesForGearClass(GearClass gearClass)
|
||||
QVector<ProjectDataManagement::ChargeType> DtcImplCustom::chargesForGearClass(GearClass gearClass)
|
||||
{
|
||||
QVector<ProjectDataManagement::ChargeTypeData> ret;
|
||||
QVector<ProjectDataManagement::ChargeType> ret;
|
||||
|
||||
if (!isGearTypeEnabled())
|
||||
{
|
||||
@@ -277,9 +277,9 @@ QVector<ProjectDataManagement::ChargeTypeData> DtcImplCustom::chargesForGearClas
|
||||
const auto gearTypesList = gearTypes();
|
||||
for (const auto &gearType : gearTypesList)
|
||||
{
|
||||
if (gearType.gearClassId() != gearClass.id())
|
||||
if (gearType.gearClassId != gearClass)
|
||||
continue;
|
||||
const int gearTypeId = gearType.id();
|
||||
const int gearTypeId = gearType.id;
|
||||
for (auto gIt = gear2ChargeMap.begin(); gIt != gear2ChargeMap.end(); ++gIt)
|
||||
{
|
||||
if (gIt->gearTypeId == gearTypeId)
|
||||
@@ -395,10 +395,10 @@ int DtcImplCustom::getTargetTypeIdFromAdlerTargetType(const QString &typ)
|
||||
|
||||
for (const auto &targetType : targetTypeMap)
|
||||
{
|
||||
if (adlerTargetTypeName(targetType) != typ)
|
||||
if (adlerTargetTypeName(targetType.id) != typ)
|
||||
continue;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " - adlerTargetTypeName: " << typ << ", targetTypeId:" << targetType;
|
||||
return targetType;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " - adlerTargetTypeName: " << typ << ", targetTypeId:" << targetType.id;
|
||||
return targetType.id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -419,10 +419,10 @@ int DtcImplCustom::getTargetSubTypeIdFromAdlerTargetSubType(const QString &subTy
|
||||
|
||||
for (const auto &targetSubType : targetSubTypeMap)
|
||||
{
|
||||
if (adlerTargetSubTypeName(targetSubType.targetSubTypeId) != subTyp)
|
||||
if (adlerTargetSubTypeName(targetSubType.id) != subTyp)
|
||||
continue;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " - adlerTargetSubTypName: " << subTyp << ", targetSubTypeId:" << targetSubType.targetSubTypeId;
|
||||
return targetSubType.targetSubTypeId;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " - adlerTargetSubTypName: " << subTyp << ", targetSubTypeId:" << targetSubType.id;
|
||||
return targetSubType.id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -444,10 +444,10 @@ int DtcImplCustom::getChargeTypeIdFromAdlerCharges(const QString &geschosssorte)
|
||||
|
||||
for (const auto &charge : chargeMap)
|
||||
{
|
||||
if (adlerChargeTypeName(charge.chargeTypeId) != geschosssorte)
|
||||
if (adlerChargeTypeName(charge.id) != geschosssorte)
|
||||
continue;
|
||||
INFO_LOG(m_logger) << "---- geschosssorte: " << geschosssorte << ", chargeTypeId:" << charge.chargeTypeId;
|
||||
return charge.chargeTypeId;
|
||||
INFO_LOG(m_logger) << "---- geschosssorte: " << geschosssorte << ", chargeTypeId:" << charge.id;
|
||||
return charge.id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -795,9 +795,9 @@ GearClass DtcImplCustom::gearClassFromChargeTypeId(int chargeTypeId)
|
||||
const auto &gearType = gearTypesMap.value(gearType2ChargeType.gearTypeId);
|
||||
|
||||
// update cache:
|
||||
s_gearClassChargeTypeCache[requestedCTID] = gearType.gearClassId();
|
||||
s_gearClassChargeTypeCache[requestedCTID] = gearType.gearClassId;
|
||||
|
||||
return gearType.gearClassId();
|
||||
return gearType.gearClassId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -952,7 +952,7 @@ QStringList DtcImplCustom::sanitationProceduresList(qint64 procedures)
|
||||
return ret << tr("DCU Connected");
|
||||
ret.reserve(proc.size());
|
||||
for (const auto &s : proc)
|
||||
ret << trSanitationProcedureName(s.name);
|
||||
ret << ProjectDataManagement::trSanitationProcedureName(s.name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -969,9 +969,9 @@ int DtcImplCustom::chargeTypeIdFromLegacyId(GearClass gearClass, int legacyId)
|
||||
for (const auto &charge : chargeMap)
|
||||
{
|
||||
// igniterType/igniterFunction default 0
|
||||
auto chargeIgniterFunction = getChargeTypeIgniterTypeIgniterFunction(charge.chargeTypeId, 0, 0);
|
||||
auto chargeIgniterFunction = getChargeTypeIgniterTypeIgniterFunction(charge.id, 0, 0);
|
||||
if (chargeIgniterFunction.chargeLegacyId == legacyId)
|
||||
return charge.chargeTypeId;
|
||||
return charge.id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -991,7 +991,7 @@ bool DtcImplCustom::isRocket(int chargeTypeId)
|
||||
{
|
||||
const GearClass gearClass = gearClassFromChargeTypeId(chargeTypeId);
|
||||
|
||||
return gearClass.underlying() == GearClass::GearClass_Rocket;
|
||||
return gearClass == GearClass::GearClass_Rocket;
|
||||
}
|
||||
|
||||
ChargeTypeIgniterTypeIgniterFunction DtcImplCustom::getChargeTypeIgniterTypeIgniterFunction(int chargeTypeId, int igniterTypeId, int igniterFunctionId)
|
||||
@@ -1283,7 +1283,7 @@ QString DtcImplCustom::trRadioGroupName(int radioGroupId) { return translate(&Dt
|
||||
QString DtcImplCustom::trVulnerabilityKindName(int vulnerabilityKindId, VulnerabilityClass vulnerabilityClassId)
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityKind vk = DtcImpl::vulnerabilityKind(vulnerabilityKindId);
|
||||
if (vk.vulnerabilityClassId() == vulnerabilityClassId)
|
||||
if (vk.vulnerabilityClassId == vulnerabilityClassId)
|
||||
return translate(&DtcImpl::vulnerabilityKind, &ProjectDataManagement::trVulnerabilityKindName, vulnerabilityKindId);
|
||||
else
|
||||
{
|
||||
@@ -1317,9 +1317,18 @@ QString DtcImplCustom::trSanitationInjuryPlace2Name(int sanitationInjuryPlace2Id
|
||||
return translate(&DtcImpl::sanitationInjuryPlace2, &ProjectDataManagement::trSanitationInjuryPlace2Name, sanitationInjuryPlace2Id);
|
||||
}
|
||||
|
||||
QJsonObject DtcImplCustom::propertiesToJson(const QJsonObject &properties)
|
||||
QJsonObject DtcImplCustom::propertiesToJson(const std::string &properties)
|
||||
{
|
||||
return properties;
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(properties.c_str(), properties.size()));
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(props, &parserError));
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Cannot parse properties: no valid json:" << properties;
|
||||
return {};
|
||||
}
|
||||
|
||||
return doc.object();
|
||||
}
|
||||
|
||||
void DtcImplCustom::setProps(ChargeTypeIgniterTypeIgniterFunctionProps &props, QJsonObject obj)
|
||||
@@ -1328,10 +1337,10 @@ void DtcImplCustom::setProps(ChargeTypeIgniterTypeIgniterFunctionProps &props, Q
|
||||
const int tmp = obj.value(QStringLiteral("volatilityTypeId")).toInt(0);
|
||||
switch (tmp)
|
||||
{
|
||||
case VolatilityType_def::Floating:
|
||||
case static_cast<int>(VolatilityType::Floating):
|
||||
props.volatilityTypeId = VolatilityType::Floating;
|
||||
break;
|
||||
case VolatilityType_def::Resident:
|
||||
case static_cast<int>(VolatilityType::Resident):
|
||||
props.volatilityTypeId = VolatilityType::Resident;
|
||||
break;
|
||||
default:
|
||||
@@ -1378,12 +1387,12 @@ void DtcImplCustom::setProps(ChargeTypeIgniterTypeIgniterFunctionProps &props, Q
|
||||
{
|
||||
QJsonObject objFt = it->toObject();
|
||||
CasEffect ce;
|
||||
ce.severityType(static_cast<SeverityType::inner_enum>(objFt.value(QStringLiteral("severityType")).toInt()));
|
||||
ce.iedClass(objFt.value(QStringLiteral("iedClass")).toInt());
|
||||
ce.impactRadius(objFt.value(QStringLiteral("impactRadius")).toInt());
|
||||
ce.severityType = static_cast<SeverityType>(objFt.value(QStringLiteral("severityType")).toInt());
|
||||
ce.iedClass = objFt.value(QStringLiteral("iedClass")).toInt();
|
||||
ce.impactRadius = objFt.value(QStringLiteral("impactRadius")).toInt();
|
||||
props.casEffects.append(ce);
|
||||
}
|
||||
std::sort(props.casEffects.begin(), props.casEffects.end(), [](const CasEffect &a, const CasEffect &b) { return a.severityType < b.severityType; });
|
||||
std::sort(props.casEffects.begin(), props.casEffects.end(), [](const CasEffect &a, const CasEffect &b) { return static_cast<int>(a.severityType) < static_cast<int>(b.severityType); });
|
||||
|
||||
// Caution: Negate as suppressVisibility is negation of isVisible!
|
||||
props.isVisible = !obj.value(QStringLiteral("suppressVisibility")).toBool(false);
|
||||
@@ -1486,14 +1495,14 @@ DtcImplCustom::GearTypeProps DtcImplCustom::gearTypeProps(int gearTypeId)
|
||||
|
||||
void DtcImplCustom::onGearTypeChargeTypeChanged(const GearTypeChargeType >ct)
|
||||
{
|
||||
if (gtct.id() <= 0)
|
||||
if (gtct.id <= 0)
|
||||
return;
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(gtct.properties().c_str(), gtct.properties().size()));
|
||||
const QByteArray props(QByteArray::fromRawData(gtct.properties.c_str(), gtct.properties.size()));
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(props, &parserError));
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
{
|
||||
m_gtctProps.remove(gtct.id());
|
||||
m_gtctProps.remove(gtct.id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1503,7 +1512,7 @@ void DtcImplCustom::onGearTypeChargeTypeChanged(const GearTypeChargeType >ct)
|
||||
gtctp.factoryDefault = obj.value(QStringLiteral("factoryDefault")).toInt(0);
|
||||
gtctp.maxCharge = obj.value(QStringLiteral("maxCharge")).toInt(0);
|
||||
|
||||
m_gtctProps.insert(gtct.id(), gtctp);
|
||||
m_gtctProps.insert(gtct.id, gtctp);
|
||||
}
|
||||
|
||||
DtcImplCustom::GearTypeChargeTypeProps DtcImplCustom::gearTypeChargeTypeProps(int gearTypeChargeTypeId)
|
||||
@@ -1592,7 +1601,7 @@ double DtcImplCustom::getLethalRadius(int chargeTypeId, int igniterTypeId, int i
|
||||
const auto &vec = casEffects(chargeTypeId, igniterTypeId, igniterFunctionId);
|
||||
for (const ProjectDataManagement::CasEffect &casEffect : vec)
|
||||
{
|
||||
if (casEffect.severityType == SeverityType_def::lethal)
|
||||
if (casEffect.severityType == SeverityType::lethal)
|
||||
return casEffect.impactRadius;
|
||||
}
|
||||
return 0.0;
|
||||
@@ -1603,7 +1612,7 @@ double DtcImplCustom::getNonLethalRadius(int chargeTypeId, int igniterTypeId, in
|
||||
const auto &vec = casEffects(chargeTypeId, igniterTypeId, igniterFunctionId);
|
||||
for (const ProjectDataManagement::CasEffect &casEffect : vec)
|
||||
{
|
||||
if (casEffect.severityType == SeverityType_def::medium)
|
||||
if (casEffect.severityType == SeverityType::medium)
|
||||
return casEffect.impactRadius;
|
||||
}
|
||||
return 0.0;
|
||||
@@ -1709,7 +1718,6 @@ QString DtcImplCustom::adlerTargetSubTypeName(int targetSubTypeId)
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
int DtcImplCustom::getAmountFireMarkers(int firePurposeId)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user