Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Handler for player data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by gr, SLSE, 2017-02-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <CentralEffectSimulation/logger.h>
|
||||
|
||||
#include <Buildings/bld_dtc.h>
|
||||
#include <CentralEffectSimulation/dds_handler.h>
|
||||
#include <CentralEffectSimulation/handler_participant.h>
|
||||
#include <CentralEffectSimulation/handler_building_data.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
// Handling for participants within buildings
|
||||
|
||||
namespace CesParticipantBuildings
|
||||
{
|
||||
|
||||
class HandlerParticipantBuilding : public QObject
|
||||
, protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HandlerParticipantBuilding(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
|
||||
const std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> &handlerBuildingData,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
~HandlerParticipantBuilding();
|
||||
|
||||
/**
|
||||
* Initialize the handler to manage information from player management
|
||||
*/
|
||||
bool init();
|
||||
int getDamagePercentFromBuilding(const int buildingId) const;
|
||||
int getDamagePercentFromRoom(const int roomId) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void newBuildingState(const int32_t buildingId);
|
||||
|
||||
protected:
|
||||
void onSendCesHitReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
/**
|
||||
* Handle BuildingState from 'BLD'
|
||||
*/
|
||||
void onBuildingStateChanged(const Buildings::BuildingState &data, DataModification modType);
|
||||
/**
|
||||
* Handle MainStructureElement from 'ISM'
|
||||
*/
|
||||
void sendFtcCesHitRequestTimeout();
|
||||
|
||||
void sendCesHitToParticipant(const Buildings::BuildingState &data,
|
||||
const int32_t participantId,
|
||||
const int32_t remainingEffectPercent);
|
||||
|
||||
|
||||
private: // attributes
|
||||
struct RoomState
|
||||
{
|
||||
int buildingId = 0;
|
||||
int damagePercent = 0;
|
||||
};
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData;
|
||||
|
||||
QHash<int, Buildings::BuildingState> m_buildingStates;
|
||||
QHash<int, RoomState> m_roomIdDamageState; // Key = roomId, value = damageState
|
||||
QHash<int, TrainingAreaBase::SendCesHitRequest> m_requestMap; // Key = participantId
|
||||
QTimer *m_timer;
|
||||
|
||||
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
||||
|
||||
};
|
||||
} // namespace CesParticipantBuildings
|
||||
|
||||
Reference in new issue
Block a user