Files
qt5-legatus-legacy/Lts/Services/AreaEffectSimulation/EffectorFiringStrategy/firing_strategy_factory.cpp
T
2026-08-13 18:33:10 +02:00

65 lines
1.6 KiB
C++
Executable File

/**
* Namespace and function for creating a Firing Strategy
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Fritsche, ESZS, 2026-05-11
*/
#include "firing_strategy_factory.h"
#include "default_firing_strategy.h"
#include "dm72_firing_strategy.h"
#include "gmlrs_firing_strategy.h"
#include "smart_firing_strategy.h"
#include "main_handler.h"
#include "object_effector.h"
namespace AreaEffectSimulation
{
namespace FiringStrategyFactory
{
AbstractFiringStrategy *createFiringStrategy(ObjectEffector *parent)
{
LOGGER_T &logger = getLogger("FiringStrategyFactory");
TRACE_LOG(logger) << LOGFUNCTION << " START";
if (!parent)
return nullptr;
const ChargeStruct &cs = parent->effectorData().chargeStruct();
DEBUG_LOG(logger) << LOGFUNCTION << " ChargeStruct = " << cs;
// GMLRS
if (parent->mainHandler()->dds()->pdmDtc()->isGmlrs(cs.chargeTypeId()))
{
TRACE_LOG(logger) << LOGFUNCTION << " END";
return new GmlrsFiringStrategy(parent);
}
// SMArt
const bool bIsSmart = parent->mainHandler()->dds()->pdmDtc()->isSmart(cs.chargeTypeId(), cs.igniterTypeId(), cs.igniterFunctionId());
if (bIsSmart)
{
TRACE_LOG(logger) << LOGFUNCTION << " END";
return new SmartFiringStrategy(parent);
}
// DM72
if (parent->mainHandler()->dds()->pdmDtc()->isDm72(cs.chargeTypeId()))
{
TRACE_LOG(logger) << LOGFUNCTION << " END";
return new Dm72FiringStrategy(parent);
}
TRACE_LOG(logger) << LOGFUNCTION << " END";
return new DefaultFiringStrategy(parent);
}
} //namespace FiringFactory
} //namespace AreaEffectSimulation