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

#include "openvic-simulation/map/Province.hpp"

namespace OpenVic {

   struct ProvinceSet {
      using provinces_t = std::vector<Province*>;

   private:
      provinces_t provinces;
      bool locked = false;

   public:
      ProvinceSet(provinces_t&& new_provinces = {});

      bool add_province(Province* province);
      void lock(bool log = false);
      bool is_locked() const;
      void reset();
      bool empty() const;
      size_t size() const;
      void reserve(size_t size);
      bool contains_province(Province const* province) const;
      provinces_t const& get_provinces() const;
   };

   /* REQUIREMENTS:
    * MAP-6, MAP-44, MAP-48
    */
   struct Region : HasIdentifier, ProvinceSet {
      friend struct Map;

   private:
      /* A meta region cannot be the template for a state.
       * Any region containing a province already listed in a
       * previously defined region is considered a meta region.
       */
      const bool meta;

      Region(const std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta);

   public:
      Region(Region&&) = default;

      bool get_meta() const;
      colour_t get_colour() const;
   };
}