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
+23
-23
@@ -17,7 +17,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerGasPipe::HandlerGasPipe(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectGasPipe>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[AesType::AtGasPipe], s_areaCountCentral[AesType::AtGasPipe])
|
||||
: HandlerBaseTmpl<ObjectGasPipe>(mainHandler, QStringLiteral("ExplosionArea"), s_areaCount[static_cast<int>(AesType::AtGasPipe)], s_areaCountCentral[static_cast<int>(AesType::AtGasPipe)])
|
||||
, Interface::Fts::GasPipeModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::GasPipeRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -52,7 +52,7 @@ bool HandlerGasPipe::init()
|
||||
|
||||
for (const Database::AesGasPipe &dbGasPipe : qAsConst(gasPipeVec))
|
||||
{
|
||||
if (dbGasPipe.effectStateId == AesEffectState_def::EsRemoved)
|
||||
if (dbGasPipe.effectStateId == AesEffectState::EsRemoved)
|
||||
continue;
|
||||
|
||||
dbGasPipeSegments.clear();
|
||||
@@ -84,7 +84,7 @@ void HandlerGasPipe::onGasPipeModifyRequest(const rti::core::SampleIdentity &coo
|
||||
const GasPipeModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onGasPipeModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? gasPipeModifyRequest(request) : gasPipeCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? gasPipeModifyRequest(request) : gasPipeCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->gasPipeModifyReply(cookie, ret);
|
||||
@@ -95,15 +95,15 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
{
|
||||
Database::AesGasPipe newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
|
||||
ObjectGasPipe *ifs(new ObjectGasPipe(m_mainHandler, this));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(newData,
|
||||
request.segments(),
|
||||
request.segments,
|
||||
QVector<Database::AesGasPipeSegment>());
|
||||
if (ret.error())
|
||||
{
|
||||
@@ -114,7 +114,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtGasPipe] && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtGasPipe)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject();
|
||||
delete ifs;
|
||||
@@ -123,7 +123,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtGasPipe] && request.effectStart().is_set())
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtGasPipe)] && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject();
|
||||
delete ifs;
|
||||
@@ -151,18 +151,18 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeCreateRequest(const GasPipeModi
|
||||
Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectGasPipe *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectGasPipe *ifs = getObjectFromMap(m_objectMap, request.id, ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
Database::AesGasPipe newData;
|
||||
|
||||
newData.name = QString::fromStdString(request.name());
|
||||
newData.effectStart = request.effectStart().is_set() && request.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart().get()) : QDateTime();
|
||||
newData.partyId = request.partyId().is_set() ? request.partyId().get() : 0;
|
||||
newData.width = request.width();
|
||||
newData.effectDuration = request.effectDuration();
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
newData.name = QString::fromStdString(request.name);
|
||||
newData.effectStart = request.effectStart.is_set() && request.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(request.effectStart.get()) : QDateTime();
|
||||
newData.partyId = request.partyId.is_set() ? request.partyId.get() : 0;
|
||||
newData.width = request.width;
|
||||
newData.effectDuration = request.effectDuration;
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite gas pipe Effect State for OC";
|
||||
newData.effectStateId = AesEffectState::EsPrepared;
|
||||
@@ -171,19 +171,19 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
!*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[AesType::AtGasPipe])
|
||||
if (totalAreasCentral() >= s_maxActiveAreasCentral[static_cast<int>(AesType::AtGasPipe)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central functional areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtGasPipe])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtGasPipe)])
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active functional areas areas."));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
}
|
||||
//TODO: Implement switch from decentral to central in gasp pipes
|
||||
// // For counting, only Elements being at least prepared are important:
|
||||
// if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
// if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
// {
|
||||
|
||||
// // Calculate new polygon here. Not nice, though
|
||||
@@ -238,7 +238,7 @@ Core::FunctionReplyObject HandlerGasPipe::gasPipeModifyRequest(const GasPipeModi
|
||||
// }
|
||||
|
||||
|
||||
return ifs->updateObject(newData, request.segments());
|
||||
return ifs->updateObject(newData, request.segments);
|
||||
} // end of onGasPipeModifyRequest()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user