Migrates AreaEffectSimulation to generated rtiddsgen API
Converts accessor calls to plain member access across aes service and plugin.
This commit is contained in:
102 files changed
+3307
-3313
No files matched your search
+15
-15
@@ -17,7 +17,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerDusSingleMine::HandlerDusSingleMine(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectDusSingleMine>(mainHandler, QStringLiteral("DusSingleMine"), s_areaCount[AesType::AtMineArea], s_areaCountCentral[AesType::AtMineArea])
|
||||
: HandlerBaseTmpl<ObjectDusSingleMine>(mainHandler, QStringLiteral("DusSingleMine"), s_areaCount[static_cast<int>(AesType::AtMineArea)], s_areaCountCentral[static_cast<int>(AesType::AtMineArea)])
|
||||
, m_tabDtc(mainHandler->dds()->tabDtc())
|
||||
{}
|
||||
|
||||
@@ -41,7 +41,7 @@ bool HandlerDusSingleMine::init()
|
||||
// If active or prepared, check if it still can be handled and increment area count
|
||||
if (ifs->isObjectInTrainingArea())
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtDusSingleMine])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtDusSingleMine)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active DUS single mines in database than allowed - ignoring the rest!";
|
||||
delete ifs;
|
||||
@@ -80,12 +80,12 @@ bool HandlerDusSingleMine::init()
|
||||
|
||||
int HandlerDusSingleMine::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtDusSingleMine];
|
||||
return s_areaCount[static_cast<int>(AesType::AtDusSingleMine)];
|
||||
}
|
||||
|
||||
int HandlerDusSingleMine::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtDusSingleMine];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtDusSingleMine)];
|
||||
}
|
||||
|
||||
void HandlerDusSingleMine::onDusSingleMineState(const TrainingAreaBase::DusSingleMineState &data, DataModification modType)
|
||||
@@ -93,31 +93,31 @@ void HandlerDusSingleMine::onDusSingleMineState(const TrainingAreaBase::DusSingl
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtDusSingleMine])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtDusSingleMine)])
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Too many active DUS single mines.";
|
||||
return;
|
||||
}
|
||||
|
||||
// set old AES item to expired
|
||||
if (m_activeMineIdToAesItemId.contains(data.mineId()))
|
||||
if (m_activeMineIdToAesItemId.contains(data.mineId))
|
||||
{
|
||||
m_objectMap.value(m_activeMineIdToAesItemId.value(data.mineId()))->setExpired();
|
||||
m_activeMineIdToAesItemId.remove(data.mineId());
|
||||
m_objectMap.value(m_activeMineIdToAesItemId.value(data.mineId))->setExpired();
|
||||
m_activeMineIdToAesItemId.remove(data.mineId);
|
||||
}
|
||||
|
||||
if (data.state())
|
||||
if (data.state)
|
||||
{
|
||||
Database::AesDusSingleMine newData;
|
||||
newData.mineId = data.mineId();
|
||||
newData.mineId = data.mineId;
|
||||
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart() + Settings::getDusSingleMineEffectStartOffset()); // offset to get away from mine after laying it
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(data.effectStart + Settings::getDusSingleMineEffectStartOffset()); // offset to get away from mine after laying it
|
||||
if (newData.effectStart <= m_mainHandler->dds()->currentPartitionTime()) // telegram arrived late -> start effect area now
|
||||
newData.effectStart = QDateTime::fromMSecsSinceEpoch(m_mainHandler->dds()->currentPartitionTimeMSec() + 100); // needs to be slightly in the future
|
||||
|
||||
newData.position.rx() = data.position().lon();
|
||||
newData.position.ry() = data.position().lat();
|
||||
newData.chargeTypeId = data.chargeTypeId();
|
||||
newData.position.rx() = data.position.lon;
|
||||
newData.position.ry() = data.position.lat;
|
||||
newData.chargeTypeId = data.chargeTypeId;
|
||||
|
||||
ObjectDusSingleMine *ifs(new ObjectDusSingleMine(m_mainHandler, this));
|
||||
connect(ifs, &ObjectDusSingleMine::effectStateChanged, this, &HandlerDusSingleMine::onEffectStateChanged);
|
||||
@@ -139,7 +139,7 @@ void HandlerDusSingleMine::onMineTriggered(const TrainingAreaBase::MineTriggered
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
auto it = m_objectMap.constFind(data.mineAreaId());
|
||||
auto it = m_objectMap.constFind(data.mineAreaId);
|
||||
if (it == m_objectMap.cend()) // is it a DUS single mine or just a normal mineArea?
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user