Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -33,7 +33,7 @@ HandlerBlockedAreas::~HandlerBlockedAreas()
bool HandlerBlockedAreas::init()
{
DEBUG_LOG() << "init";
DEBUG_LOG(m_logger) << "init";
connect(m_handlerParticipant.get(), &CentralEffectSimulation::HandlerParticipant::newIndoorPosition,
this, &HandlerBlockedAreas::onParticipantPositionChanged);
connect(m_handlerParticipant.get(), &CentralEffectSimulation::HandlerParticipant::newOutdoorPosition,
@@ -48,16 +48,16 @@ bool HandlerBlockedAreas::init()
void HandlerBlockedAreas::onSendParticipantBlockedAreaReply(const Core::FunctionReplyObject &replyObject)
{
if (replyObject.error())
WARNING_LOG() << "Can not send blocked Area to participant : " << replyObject();
WARNING_LOG(m_logger) << "Can not send blocked Area to participant : " << replyObject();
else
DEBUG_LOG() << "onSendParticipantBlockedAreaReply for id " << replyObject.id() << " success";
DEBUG_LOG(m_logger) << "onSendParticipantBlockedAreaReply for id " << replyObject.id() << " success";
}
void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &partPos)
{
const int participantId = partPos.participantId();
int damagePercentBlockedAreas = 90; // From the percentage damage, blocked area applies Todo Config Value
DEBUG_LOG() << "HandlerBlockedAreas onParticipantPositionChanged participantId=" << participantId;
DEBUG_LOG(m_logger) << "HandlerBlockedAreas onParticipantPositionChanged participantId=" << participantId;
TrainingAreaBase::SendParticipantBlockedAreaRequest pba;
pba.equipmentNumber(m_ddsHandler->participantId2EquipNo(partPos.participantId()));
@@ -70,7 +70,7 @@ void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimula
auto it = m_blockedAreas.find(participantId);
if (it != m_blockedAreas.end())
{
DEBUG_LOG() << "Blocked Area Leave equipment-No. =" << pba.equipmentNumber();
DEBUG_LOG(m_logger) << "Blocked Area Leave equipment-No. =" << pba.equipmentNumber();
pba.blockedAreaMode(TrainingAreaBase::BlockedAreaMode_def::Leave);
m_ddsHandler->ftcTab()->sendParticipantBlockedAreaRequest(pba, this);
m_blockedAreas.erase(it);
@@ -83,7 +83,7 @@ void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimula
if (m_blockedAreas.contains(participantId) &&
(m_handlerParticipantBuilding->getDamagePercentFromRoom(partPos.roomId()) < damagePercentBlockedAreas))
{
DEBUG_LOG() << "Blocked Area Leave equipment-No. =" << pba.equipmentNumber();
DEBUG_LOG(m_logger) << "Blocked Area Leave equipment-No. =" << pba.equipmentNumber();
pba.blockedAreaMode(TrainingAreaBase::BlockedAreaMode_def::Leave);
m_ddsHandler->ftcTab()->sendParticipantBlockedAreaRequest(pba, this);
m_blockedAreas.remove(participantId);
@@ -92,9 +92,9 @@ void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimula
}
DEBUG_LOG() << "Room =" << partPos.roomId()
DEBUG_LOG(m_logger) << "Room =" << partPos.roomId()
<< " DamagePercentRoom=" << m_handlerParticipantBuilding->getDamagePercentFromRoom(partPos.roomId());
DEBUG_LOG() << "1: " << m_handlerParticipantBuilding->getDamagePercentFromRoom(partPos.roomId())
DEBUG_LOG(m_logger) << "1: " << m_handlerParticipantBuilding->getDamagePercentFromRoom(partPos.roomId())
<< " damagePercentBlockedAreas= " << damagePercentBlockedAreas << "\n"
<< " getDamagePercentFromBuilding=" << m_handlerParticipantBuilding->getDamagePercentFromBuilding(partPos.buildingId()) << "\n"
<< "m_blockedAreas.contains(participantId) = " << m_blockedAreas.contains(participantId) ;
@@ -105,7 +105,7 @@ void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimula
|| m_handlerParticipantBuilding->getDamagePercentFromBuilding(partPos.buildingId()) == 100)
&& !m_blockedAreas.contains(participantId))
{
DEBUG_LOG() << "Send Enter Blocked Area to Participant:" << participantId;
DEBUG_LOG(m_logger) << "Send Enter Blocked Area to Participant:" << participantId;
pba.blockedAreaMode(TrainingAreaBase::BlockedAreaMode_def::Enter);
m_ddsHandler->ftcTab()->sendParticipantBlockedAreaRequest(pba, this);
m_blockedAreas.insert(participantId, partPos.roomId());
@@ -115,7 +115,7 @@ void HandlerBlockedAreas::onParticipantPositionChanged(const CentralEffectSimula
void HandlerBlockedAreas::onBuildingStateChanged(const int32_t buildingId)
{
DEBUG_LOG() << "onBuildingStateChanged buildingId:" << buildingId;
DEBUG_LOG(m_logger) << "onBuildingStateChanged buildingId:" << buildingId;
int damagePercent = m_handlerParticipantBuilding->getDamagePercentFromBuilding(buildingId);
if (damagePercent == 0 && !m_blockedAreas.isEmpty()) // init
{
@@ -124,7 +124,7 @@ void HandlerBlockedAreas::onBuildingStateChanged(const int32_t buildingId)
{
if (m_blockedAreas.contains(participantId))
{
DEBUG_LOG() << "remove participantId: " << participantId;
DEBUG_LOG(m_logger) << "remove participantId: " << participantId;
TrainingAreaBase::SendParticipantBlockedAreaRequest pba;
pba.equipmentNumber(m_ddsHandler->participantId2EquipNo(participantId));
pba.participantId(participantId);
@@ -63,7 +63,7 @@ bool HandlerParticipantBuilding::init()
//-----------------------------------------------------------------------------
int HandlerParticipantBuilding::getDamagePercentFromBuilding(const int buildingId) const
{
DEBUG_LOG() << "getDamagePercentFromBuilding buildingId=" << buildingId;
DEBUG_LOG(m_logger) << "getDamagePercentFromBuilding buildingId=" << buildingId;
auto it = m_buildingStates.find(buildingId);
return it != m_buildingStates.end() ? it.value().damagePercent() : 0;
}
@@ -78,14 +78,14 @@ int HandlerParticipantBuilding::getDamagePercentFromRoom(const int roomId) const
// Exception:
// if a building has failed completely, not all individual rooms are set as failed
DEBUG_LOG() << "getDamagePercentFromBuilding=" << getDamagePercentFromBuilding(buildingId)
DEBUG_LOG(m_logger) << "getDamagePercentFromBuilding=" << getDamagePercentFromBuilding(buildingId)
<< " buildingId=" << buildingId
<< " roomId=" << roomId;
if (buildingId < 0)
return -1;
if (getDamagePercentFromBuilding(buildingId) == PERCENT_100)
{
DEBUG_LOG() << "return PERCENT_100:" << PERCENT_100;
DEBUG_LOG(m_logger) << "return PERCENT_100:" << PERCENT_100;
return PERCENT_100;
}
return it != m_roomIdDamageState.end() ? it.value().damagePercent : 0;
@@ -94,10 +94,10 @@ int HandlerParticipantBuilding::getDamagePercentFromRoom(const int roomId) const
void HandlerParticipantBuilding::onSendCesHitReply(const Core::FunctionReplyObject &replyObject)
{
//if (replyObject.error())
// WARNING_LOG() << "Can not send hit on participant to training area: " << replyObject();
// WARNING_LOG(m_logger) << "Can not send hit on participant to training area: " << replyObject();
//else
m_requestMap.remove(replyObject.id());
DEBUG_LOG() << "onSendCesHitReply for id " << replyObject.id() << " success"
DEBUG_LOG(m_logger) << "onSendCesHitReply for id " << replyObject.id() << " success"
<< " m_requestMap.remove(" << replyObject.id() << ")"
<< " m_requestMap.size=" << m_requestMap.size();
@@ -114,7 +114,7 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
return;
}
DEBUG_LOG() << "Got BuildingState originatorParticipantId=" << data.originatorParticipantId()
DEBUG_LOG(m_logger) << "Got BuildingState originatorParticipantId=" << data.originatorParticipantId()
<< ", aesId = " << data.aesId()
<< ", chargeTypeId = " << data.chargeTypeId()
<< ", sampleTime = " << data.sampleTime()
@@ -126,7 +126,7 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
if ( (data.originatorParticipantId() == 0) && (data.aesId() == 0) && (data.chargeTypeId()==0))
{
DEBUG_LOG() << "Not valid return ";
DEBUG_LOG(m_logger) << "Not valid return ";
return;
}
@@ -134,7 +134,7 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
RoomState rs;
rs.buildingId = data.id();
m_buildingStates.insert(data.id(), data);
DEBUG_LOG() << "m_buildingStates.insert id=" << data.id()
DEBUG_LOG(m_logger) << "m_buildingStates.insert id=" << data.id()
<< " aesId=" << data.aesId()
<< " name=" << data.name();
@@ -142,7 +142,7 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
{
rs.damagePercent = roomState.damagePercent();
m_roomIdDamageState.insert(roomState.id(), rs);
DEBUG_LOG() << "m_roomIdDamageState.insert"
DEBUG_LOG(m_logger) << "m_roomIdDamageState.insert"
<< " RoomId = " << roomState.id()
<< ", BuildingId = " << data.id()
<< ", destruction = " << roomState.damagePercent();
@@ -170,7 +170,7 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
if (roomState.remainingEffectPercent() == 0)
continue;
DEBUG_LOG() << " RoomId[" << roomState.id() << "]:"
DEBUG_LOG(m_logger) << " RoomId[" << roomState.id() << "]:"
<< " remainingEffectPercent = " << roomState.remainingEffectPercent()
<< " roomState.damagePercent()=" << roomState.damagePercent()
<< " roomState.remainingEffectPercent()=" << roomState.remainingEffectPercent();
@@ -190,14 +190,14 @@ void HandlerParticipantBuilding::onBuildingStateChanged(const Buildings::Buildin
if (m_handlerParticipant->isOutdated(participantPos))
continue;
DEBUG_LOG() << " participantId = " << participantId
DEBUG_LOG(m_logger) << " participantId = " << participantId
<< " roomId = " << participantPos.roomId()
<< " roomState.id=" << roomState.id()
<< " participantPos.vulnerabilityState=" << participantPos.vulnerabilityState
<< " equipNo=" << m_ddsHandler->participantId2EquipNo(participantId)
<< " isOutdated=" << m_handlerParticipant->isOutdated(participantPos);
DEBUG_LOG() << "sendCesHitToParticipant";
DEBUG_LOG(m_logger) << "sendCesHitToParticipant";
sendCesHitToParticipant(data, participantId, roomState.remainingEffectPercent());
}
}
@@ -228,7 +228,7 @@ void HandlerParticipantBuilding::sendCesHitToParticipant(const Buildings::Buildi
bool itemAvailable = m_ddsHandler->dtcAes()->aesItemFromId(data.aesId(), aesItem);
if (itemAvailable)
DEBUG_LOG() << "partyId=" << aesItem.partyId()
DEBUG_LOG(m_logger) << "partyId=" << aesItem.partyId()
<< " chargeTypeId=" << aesItem.chargeStruct().chargeTypeId()
<< " duration=" << aesItem.effectDuration();
@@ -245,7 +245,7 @@ void HandlerParticipantBuilding::sendCesHitToParticipant(const Buildings::Buildi
if (itemAvailable) chargeStruct = aesItem.chargeStruct();
int remainTasCodeIndirect = m_ddsHandler->remainingTasCode(chargeStruct);
DEBUG_LOG() << " ftc sendCESHit to Participant equipNo = " << equipNo
DEBUG_LOG(m_logger) << " ftc sendCESHit to Participant equipNo = " << equipNo
<< " participantId=" << participantId
<< " chargeTypeId=" << data.chargeTypeId()
<< " originatorEquipNo=" << originatorEquipNo
@@ -293,7 +293,7 @@ void HandlerParticipantBuilding::sendCesHitToParticipant(const Buildings::Buildi
// }
// else
{
DEBUG_LOG() << "direkter Beschuss remainEffectPercent=" << remainingEffectPercent;
DEBUG_LOG(m_logger) << "direkter Beschuss remainEffectPercent=" << remainingEffectPercent;
requestTab.remainEffectPercent(remainingEffectPercent);
}
@@ -305,7 +305,7 @@ void HandlerParticipantBuilding::sendFtcCesHitRequestTimeout()
auto ftcTab = m_ddsHandler->ftcTab();
for (const TrainingAreaBase::SendCesHitRequest &hr : std::as_const(m_requestMap))
{
DEBUG_LOG() << "sendFtcCesHitRequest: " << hr;
DEBUG_LOG(m_logger) << "sendFtcCesHitRequest: " << hr;
ftcTab->sendCesHitRequest(hr, this);
}
m_requestMap.clear();
@@ -51,12 +51,12 @@ bool CesParticipantBuildingsInterfaceImpl::init(int domainId, int exerciseId)
{
m_domainId = domainId;
m_exerciseId = exerciseId;
INFO_LOG() << "CesParticipantBuildingsInterfaceImpl::init()"
INFO_LOG(m_logger) << "CesParticipantBuildingsInterfaceImpl::init()"
<< " m_domainId=" << m_domainId
<< " m_exerciseId=" << m_exerciseId;
INFO_LOG() << "initialize HandlerParticipantBuilding ----------------------------";
INFO_LOG(m_logger) << "initialize HandlerParticipantBuilding ----------------------------";
m_handlerParticipantBuilding = std::make_shared<HandlerParticipantBuilding>(m_ddsHandler,
m_handlerParticipant,
m_handlerBuildingData,
@@ -64,15 +64,15 @@ bool CesParticipantBuildingsInterfaceImpl::init(int domainId, int exerciseId)
if (!m_handlerParticipantBuilding->init())
{
ERROR_LOG() << "Initialisation HandlerParticipantData failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerParticipantData failed.";
return false;
}
INFO_LOG() << "end initialize HandlerParticipantBuilding ----------------------------";
INFO_LOG(m_logger) << "end initialize HandlerParticipantBuilding ----------------------------";
if (Settings::handleBlockedAreas())
{
INFO_LOG() << "initialize HandlerBlockedAreas ----------------------------";
INFO_LOG(m_logger) << "initialize HandlerBlockedAreas ----------------------------";
// initialize HandlerBlockedAreas
m_handlerBlockedAreas = std::make_shared<HandlerBlockedAreas>(m_ddsHandler,
m_handlerParticipant,
@@ -82,11 +82,11 @@ bool CesParticipantBuildingsInterfaceImpl::init(int domainId, int exerciseId)
// Blocked Areas
if (!m_handlerBlockedAreas->init())
{
ERROR_LOG() << "Initialisation m_handlerBlockedAreas failed.";
ERROR_LOG(m_logger) << "Initialisation m_handlerBlockedAreas failed.";
return false;
}
}
INFO_LOG() << "CesParticipantBuildingsInterfaceImpl::init() return true";
INFO_LOG(m_logger) << "CesParticipantBuildingsInterfaceImpl::init() return true";
return true;
}
@@ -94,8 +94,8 @@ QString CesParticipantBuildingsInterfaceImpl::echo(const QString &message)
{
QString ret(QStringLiteral("<<<< %1 >>>> CES_FUNCTIONAL_AREAInterfaceImpl::echo").arg(message));
INFO_LOG() << "CES_FUNCTIONAL_AREAInterfaceImpl::echo return:" << ret;
DEBUG_LOG() << "DEBUG: CesParticipantBuildingsInterfaceImpl::echo return:" << ret;
INFO_LOG(m_logger) << "CES_FUNCTIONAL_AREAInterfaceImpl::echo return:" << ret;
DEBUG_LOG(m_logger) << "DEBUG: CesParticipantBuildingsInterfaceImpl::echo return:" << ret;
return ret;
}
} //namespace CesParticipantBuildings