- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
153 lines
5.0 KiB
C++
Executable File
153 lines
5.0 KiB
C++
Executable File
/**
|
|
* Handler for player data
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by gr, SLSE, 2017-02-20
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "CentralEffectSimulation/dds_handler.h"
|
|
#include "GeoPairing/GeoPairing.hpp"
|
|
#include "logger.h"
|
|
|
|
#include <TrainingAreaBase/tab_dtc.h>
|
|
#include <MeteoDataManagement/mdm_dtc.h>
|
|
#include <CentralEffectSimulation/handler_participant.h>
|
|
#include <FW_Ballistic/BallisticService.hpp>
|
|
#include <QTimer>
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
// AES-Handling for participants within buildings
|
|
|
|
namespace CesGeoPairing
|
|
{
|
|
|
|
class HandlerGeoPairing : public QObject
|
|
, protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler
|
|
, protected TrainingAreaBase::Interface::Ftc::SendCesHitInformationReplyHandler
|
|
, protected TrainingAreaBase::Interface::Ftc::SendGeopairingDataReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionSingleModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionAreaModifyReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum ElevationError
|
|
{
|
|
eNoElevationError = 0,
|
|
eElevationToHigh = 1,
|
|
eElevationToLow = 2,
|
|
eElevationBelowZero = 3
|
|
};
|
|
private:
|
|
struct GeoPCharge
|
|
{
|
|
|
|
int chargeId;
|
|
double minEleval;
|
|
double maxEleval;
|
|
// QMap<weaponTypeId, allowed yes/no>
|
|
QMap<int, bool> isAllowed;
|
|
|
|
ElevationError checkElevation(double elevation) const
|
|
{
|
|
if (elevation < 0)
|
|
return eElevationBelowZero;
|
|
if (elevation < minEleval)
|
|
return eElevationToLow;
|
|
if (elevation > maxEleval)
|
|
return eElevationToHigh;
|
|
return eNoElevationError;
|
|
}
|
|
|
|
// Check if Elevation and Charge is correct, return _false_ if errors accure and
|
|
// change the Error integers
|
|
bool checkArty(int weaponTypeId, double elevation, ElevationError &eleError, int &chargeError) const
|
|
{
|
|
eleError = checkElevation(elevation);
|
|
bool ret = (eleError == eNoElevationError);
|
|
|
|
if (!isAllowed.value(weaponTypeId)) //Falls wert nicht vorhanden immer Falsche Kombi
|
|
{
|
|
chargeError = 1;
|
|
ret = false;
|
|
}
|
|
else
|
|
chargeError = 0;
|
|
|
|
return ret;
|
|
}
|
|
|
|
GeoPCharge(int _chargeId, double _minEleval, double _maxEleval, const QMap<int, bool> &_isAllowed)
|
|
: chargeId(_chargeId), minEleval(_minEleval), maxEleval(_maxEleval), isAllowed(_isAllowed)
|
|
{}
|
|
|
|
GeoPCharge()
|
|
: chargeId(-1), minEleval(-1), maxEleval(-1)
|
|
{}
|
|
};
|
|
typedef QMap<int, QMap<int, GeoPCharge> > GeoPMunitonMap;
|
|
|
|
public:
|
|
explicit HandlerGeoPairing(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandlerAes,
|
|
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
|
|
const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService,
|
|
QObject *parent = nullptr);
|
|
|
|
~HandlerGeoPairing();
|
|
|
|
/**
|
|
* Initialize the handler to manage information from player management
|
|
*/
|
|
bool init();
|
|
int getDamagePercentFromBuilding(const int buildingId) const;
|
|
int getDamagePercentFromRoom(const int roomId) const;
|
|
|
|
protected:
|
|
void onSendCesHitReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onSendCesHitInformationReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onExplosionSingleModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onExplosionAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onSendGeopairingDataReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
|
|
private Q_SLOTS:
|
|
|
|
/**
|
|
* Handle MeteoData 'MDM'
|
|
*/
|
|
void onMeteoDataChanged(const MeteoDataManagement::MeteoData &data, DataModification modType);
|
|
|
|
/**
|
|
* Handle GeopairingData greom 'TAB'
|
|
*/
|
|
void onGeoPairingDataChanged(const TrainingAreaBase::GeopairingData &data, DataModification modType);
|
|
|
|
/**
|
|
* Handle MainStructureElement from 'ISM'
|
|
*/
|
|
void sendFtcCesHitRequestTimeout();
|
|
|
|
private: // attributes
|
|
|
|
double calculateDistance(const float v0, const float elevation);
|
|
double calculateFlightTime(const float rw, const float v0, const float elevation);
|
|
QPointF calculateExplosionPosUtm(const float rw, const float azimut, const QPointF &posUtm);
|
|
|
|
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandlerAes; ///< Pointer to DDS handler
|
|
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
|
std::shared_ptr<N_Ballistic::BallisticService> m_ballisticService; ///< Pointer Ballistic Service
|
|
|
|
QHash<int, TrainingAreaBase::SendCesHitRequest> m_requestMap; // Key = equipmentNumber
|
|
QTimer *m_timer;
|
|
MeteoDataManagement::MeteoData m_meteoData;
|
|
GeoPMunitonMap m_geoPMunMap;
|
|
GeoPairing *m_geoPairingPtr;
|
|
|
|
|
|
|
|
};
|
|
} // namespace CesGeoPairing
|
|
|