aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/State.hpp
blob: bae83f7f9bc13f48686e216dda73bdcc8fe9bd20 (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
#pragma once

#include "openvic-simulation/map/Province.hpp"
#include "openvic-simulation/map/Region.hpp"
#include "openvic-simulation/country/Country.hpp"

#include <deque>

namespace OpenVic {
   struct State {
   private:
      Country const* PROPERTY_RW(owner);
      Province const* PROPERTY_RW(capital);
      Region::provinces_t PROPERTY(provinces);
      Province::colony_status_t PROPERTY_RW(colony_status);

   public:
      State(
         Country const* owner, Province const* capital, Region::provinces_t&& provinces,
         Province::colony_status_t colony_status
      );
   };

   struct StateSet {
      using states_t = std::deque<State>;

   private:
      Region const& PROPERTY(region);
      states_t PROPERTY(states);

   public:
      StateSet(Map& map, Region const& new_region);

      states_t& get_states();
   };

   /* Contains all current states.*/
   struct StateManager {
   private:
      std::vector<StateSet> PROPERTY(regions);

   public:
      /* Creates states from current province gamestate & regions, sets province state value.
       * After this function, the `regions` property is unmanaged and must be carefully updated and
       * validated by functions that modify it. */
      void generate_states(Map& map);
   };
} // namespace OpenVic