/** * Handler for player data * $Id$ * $HeadURL$ * $Author$ * Created by gr, SLSE, 2017-02-20 */ #pragma once #include #include #include #include #include #include #include #include #include #include // AES-Handling for participants namespace CesVirtualMines { class HandlerParticipantBoobyTrap final : public QObject , protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler , protected AreaEffectSimulation::Interface::Ftc::BoobyTrapTriggerReplyHandler { Q_OBJECT public: HandlerParticipantBoobyTrap(const std::shared_ptr &ddsHandler, const std::shared_ptr &participantHandler, QObject *parent = nullptr); ~HandlerParticipantBoobyTrap(); /** * Initialize the handler to manage information from player management */ bool init(); protected: void onSendCesHitReply(const Core::FunctionReplyObject &replyObject) override final; void onBoobyTrapTriggerReply(const Core::FunctionReplyObject &replyObject) override final; private Q_SLOTS: /** * Handle the signals from 'ParticipantHandler' */ void onParticipantPositionChanged(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &partPos); /** * Handle the signals from 'AES' */ void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType); void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data, DataModification modType); void sendFtcBoobyTrapTrigger(int aesItemId); /** * Send Hit to participant */ void sendFtcCesHitRequestTimeout(); private: // methoden void sendParticipantEvent(const CentralEffectSimulation::AesItemViewUtm &boobyTrapItem, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition, const ProjectDataManagement::EventType eventType); void sendParticipantHit(const CentralEffectSimulation::AesItemViewUtm &boobyTrap, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition, const ProjectDataManagement::EventType eventType); bool insideSecondaryArea(const QPolygonF &polygonf, const QPointF &participantPos) const; bool enteredOrCrossedArea(const QPolygonF &polygonf, const QPolygonF &participantStep) const; bool calculateBoobyTrapParticipant(const CentralEffectSimulation::AesItemViewUtm &aesItemView, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPos); void calculateBoobyTrapParticipantSecondary(const CentralEffectSimulation::AesItemViewUtm &aesItemView, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPos); void calculateBoobyTrapParticipantsSecondary(int aesItemId, int participantId); bool intersectsBoundingBoxCheck(const CentralEffectSimulation::AesItemViewUtm &itemView, const int participantId); private: // attributes std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler std::shared_ptr m_handlerParticipant; // AES-Values QHash m_boobyTraps; QHash m_boobyTrapItems; // key = aesItemId QHash m_boobyTrapItemsSecondary; // key = aesItemId QHash m_triggeredMineParticipant; // key = aesItemId, value = participantId QHash m_requestMap; // Key = equipmentNumber QTimer *m_timer; CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility }; } // namespace CesVirtualMines