100 lines
3.1 KiB
C++
Executable File
100 lines
3.1 KiB
C++
Executable File
/**
|
|
* Handler for player data
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by gr, SLSE, 2017-02-20
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "line_of_sight.h"
|
|
|
|
#include <CentralEffectSimulation/logger.h>
|
|
//#include <CentralEffectSimulation/dds_handler.h>
|
|
#include <CentralEffectSimulation/aes_item_view_utm.h>
|
|
#include <CentralEffectSimulation/handler_participant.h>
|
|
//#include <CentralEffectSimulation/proxy_building.h>
|
|
|
|
|
|
#include <QHash>
|
|
#include <QVector>
|
|
#include <QPolygonF>
|
|
|
|
|
|
// AES-Handling for Artillery
|
|
|
|
namespace CES_Artillery
|
|
{
|
|
|
|
enum class RANGE
|
|
{
|
|
LETHAL = 1,
|
|
NON_LETHAL = 2,
|
|
HAZARD_DISTANCE = 3,
|
|
OUTSIDE = 4
|
|
};
|
|
QString toString(RANGE range);
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Helper class EnteredHarzardDistanceStorage
|
|
//------------------------------------------------------------------------------
|
|
class EnteredHarzardDistanceStorage final
|
|
{
|
|
public:
|
|
Q_DISABLE_COPY(EnteredHarzardDistanceStorage)
|
|
|
|
EnteredHarzardDistanceStorage();
|
|
~EnteredHarzardDistanceStorage();
|
|
|
|
void participantEnteringArea(int participantId, int areaId);
|
|
void participantLeavingArea(int participantId, int areaId);
|
|
bool hasParticipantAlreadyEnteredArea(int participantId, int areaId) const; ///< or isWithinArea?
|
|
void removeParticipant(int participantId);
|
|
void removeArea(int aesItemId);
|
|
|
|
QVector<int> allParticipantIdsOfArea(int areaId) const;
|
|
|
|
private:
|
|
class Private;
|
|
/**
|
|
* The private d->pointer to not break BC when changing internals of this class
|
|
*/
|
|
Private *d = nullptr;
|
|
};
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Helper class HandledImpactsStorage
|
|
//------------------------------------------------------------------------------
|
|
class HandlerArtilleryLogic final
|
|
{
|
|
public:
|
|
using AES_ITEM_VIEW_UTM_CONST_ITER = QHash<int, CentralEffectSimulation::AesItemViewUtm>::const_iterator;
|
|
|
|
HandlerArtilleryLogic();
|
|
~HandlerArtilleryLogic() = default;
|
|
|
|
int checkPartEnterLeaveArea(HandlerArtilleryLogic::AES_ITEM_VIEW_UTM_CONST_ITER currentAreaIt,
|
|
const HandlerArtilleryLogic::AES_ITEM_VIEW_UTM_CONST_ITER &endingAreaIt,
|
|
CentralEffectSimulation::HandlerParticipant::POSITIONS_CONST_ITER currentParticipantIt,
|
|
const CentralEffectSimulation::HandlerParticipant::POSITIONS_CONST_ITER &endingParticipantIt);
|
|
|
|
|
|
QVector<double> chargeRanges(int chargeTypeId) const;
|
|
static RANGE getMostInnerRange(const QVector<double> &ranges, double currentDistance);
|
|
|
|
private: // attributes
|
|
|
|
// std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
|
|
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
|
// std::shared_ptr<CentralEffectSimulation::ProxyBuilding> m_proxyBuilding;
|
|
|
|
EnteredHarzardDistanceStorage m_enteredHazardDistanceStore; // which participant are in which areas (aesItemids)
|
|
|
|
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
|
};
|
|
|
|
|
|
} // namespace CES_Artillery
|
|
|