-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShipService.hh
54 lines (41 loc) · 1.43 KB
/
ShipService.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "AbstractService.hh"
#include "Coordinator.hh"
#include "DatabaseEntityMapper.hh"
#include <eigen3/Eigen/Eigen>
#include <memory>
#include <optional>
namespace bsgo {
class ShipService : public AbstractService
{
public:
ShipService(const Repositories &repositories,
CoordinatorShPtr coordinator,
DatabaseEntityMapper &entityMapper);
~ShipService() override = default;
bool trySelectShip(const Uuid shipDbId) const;
bool tryDock(const Uuid shipDbId) const;
bool accelerateShip(const Uuid shipDbId, const Eigen::Vector3f &acceleration) const;
struct TargetAcquiringData
{
Uuid shipDbId{};
Eigen::Vector3f position{};
std::optional<Uuid> targetDbIdHint{};
std::optional<EntityKind> targetKindHint{};
};
struct AcquiringResult
{
bool success{false};
std::optional<EntityKind> targetKind{};
std::optional<Uuid> targetDbId{};
};
auto tryAcquireTarget(const TargetAcquiringData &data) const -> AcquiringResult;
private:
CoordinatorShPtr m_coordinator{};
DatabaseEntityMapper &m_entityMapper;
void switchActiveShip(PlayerShip currentActiveShip, PlayerShip newActiveShip) const;
void switchShipSystem(const PlayerShip ¤tActiveShip, const PlayerShip &newActiveShip) const;
void updateEntityTarget(Entity &entity, const std::optional<Uuid> &targetId) const;
};
using ShipServiceShPtr = std::shared_ptr<ShipService>;
} // namespace bsgo