/** * Handler for player data * $Id$ * $HeadURL$ * $Author$ * Created by gr, SLSE, 2017-02-20 */ #pragma once #include "line_of_sight.h" #include //#include #include #include //#include #include #include #include // 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 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::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 chargeRanges(int chargeTypeId) const; static RANGE getMostInnerRange(const QVector &ranges, double currentDistance); private: // attributes // std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler std::shared_ptr m_handlerParticipant; // std::shared_ptr 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