aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/country/CountryInstance.hpp
blob: 7efd930cc3124969c3c790fc15427f7a4a610dab (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
#pragma once

#include "openvic-simulation/country/Country.hpp"
#include "openvic-simulation/history/CountryHistory.hpp"
#include "openvic-simulation/map/Province.hpp"
#include "openvic-simulation/utility/Getters.hpp"

namespace OpenVic {
   struct UnitInstanceManager;

   /* Representation of an existing country that is currently in-game. */
   struct CountryInstance {
      friend struct CountryInstanceManager;
   private:
      Country const* PROPERTY_RW(base_country);
      Culture const* PROPERTY_RW(primary_culture);
      std::vector<Culture const*> PROPERTY(accepted_cultures);
      Religion const* PROPERTY_RW(religion);
      CountryParty const* PROPERTY_RW(ruling_party);
      Date PROPERTY_RW(last_election);
      fixed_point_map_t<Ideology const*> PROPERTY(upper_house);
      Province const* PROPERTY_RW(capital);
      GovernmentType const* PROPERTY_RW(government_type);
      fixed_point_t PROPERTY_RW(plurality);
      NationalValue const* PROPERTY_RW(national_value);
      bool PROPERTY_RW(civilised);
      fixed_point_t PROPERTY_RW(prestige);
      std::vector<Reform const*> PROPERTY(reforms); // TODO: should be map of reform groups to active reforms: must set defaults & validate applied history
      // TODO: Military units + OOBs; will probably need an extensible deployment class

      CountryInstance(Country const* new_base_country);

   public:
      std::string_view get_identifier() const;

      bool add_accepted_culture(Culture const* new_accepted_culture);
      bool remove_accepted_culture(Culture const* culture_to_remove);
      /* Add or modify a party in the upper house. */
      void add_to_upper_house(Ideology const* party, fixed_point_t popularity);
      bool remove_from_upper_house(Ideology const* party);
      bool add_reform(Reform const* new_reform);
      bool remove_reform(Reform const* reform_to_remove);

      bool apply_history_to_country(CountryHistoryEntry const* entry);
   };

   struct CountryInstanceManager {
   private:
      std::vector<CountryInstance> PROPERTY(country_instances);

   public:
      bool generate_country_instances(CountryManager const& country_manager);

      bool apply_history_to_countries(
         CountryHistoryManager const& history_manager, Date date, UnitInstanceManager& unit_instance_manager, Map& map
      );
   };
} // namespace OpenVic