aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/Deployment.hpp
blob: 9eb0a72e8d28550248685de4c07692bb22d5fa52 (plain) (blame)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once

#include <filesystem>
#include <string>
#include <string_view>
#include <vector>

#include "openvic-simulation/dataloader/Dataloader.hpp"
#include "openvic-simulation/dataloader/NodeTools.hpp"
#include "openvic-simulation/map/Province.hpp"
#include "openvic-simulation/military/LeaderTrait.hpp"
#include "openvic-simulation/military/Unit.hpp"
#include "openvic-simulation/types/Date.hpp"
#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"

namespace OpenVic {
   struct Leader {
      std::string name;
      const Unit::type_t type;
      const Date date;
      LeaderTrait const* personality;
      LeaderTrait const* background;
      fixed_point_t prestige;
   };

   struct Regiment {
      std::string name;
      Unit const* type;
      Province const* home;
   };

   struct Ship {
      std::string name;
      Unit const* type;
   };

   struct Army {
      std::string name;
      Province const* location;
      std::vector<Regiment> regiments;
   };

   struct Navy {
      std::string name;
      Province const* location;
      std::vector<Ship> ships;
   };

   struct DeploymentManager;

   struct Deployment : HasIdentifier {
      friend struct DeploymentManager;

   private:
      const std::vector<Army> armies;
      const std::vector<Navy> navies;
      const std::vector<Leader> leaders;

      Deployment(std::string_view new_path, std::vector<Army>&& new_armies,
         std::vector<Navy>&& new_navies, std::vector<Leader>&& new_leaders);

   public:
      const std::vector<Army>& get_armies() const;
      const std::vector<Navy>& get_navies() const;
      const std::vector<Leader>& get_leaders() const;
   };

   struct DeploymentManager {
   private:
      IdentifierRegistry<Deployment> deployments;

   public:
      DeploymentManager();

      bool add_deployment(std::string_view path, std::vector<Army>&& armies,
         std::vector<Navy>&& navies, std::vector<Leader>&& leaders);
      IDENTIFIER_REGISTRY_ACCESSORS(deployment);

      bool load_oob_file(GameManager& game_manager, std::string_view path, ast::NodeCPtr root);
   };
} // namespace OpenVic