diff options
author | ClarkeCode <clarke.john.robert@gmail.com> | 2023-04-27 22:13:52 +0200 |
---|---|---|
committer | ClarkeCode <clarke.john.robert@gmail.com> | 2023-04-27 22:13:52 +0200 |
commit | 0b273743b480874281a8987c72b2f1b666bc289a (patch) | |
tree | 3f5d5a6316ac66407e61c8a56fe732cdf06209e5 /extension/src/openvic2/map/Province.hpp | |
parent | 98dd680a641a2cbe0f1f93202a5beffdfd35c9f7 (diff) | |
parent | 10053cf259c55ee45803268a844edf1011d8a16b (diff) |
Merge branch 'main' of github.com:OpenVic2Project/OpenVic2 into goods
Diffstat (limited to 'extension/src/openvic2/map/Province.hpp')
-rw-r--r-- | extension/src/openvic2/map/Province.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/extension/src/openvic2/map/Province.hpp b/extension/src/openvic2/map/Province.hpp new file mode 100644 index 0000000..aa0329c --- /dev/null +++ b/extension/src/openvic2/map/Province.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "openvic2/map/Building.hpp" + +namespace OpenVic2 { + struct Map; + struct Region; + + /* REQUIREMENTS: + * MAP-5, MAP-8, MAP-43, MAP-47 + */ + struct Province : HasIdentifier { + friend struct Map; + + using colour_t = uint32_t; + using index_t = uint16_t; + using life_rating_t = int8_t; + + static constexpr colour_t NULL_COLOUR = 0, MAX_COLOUR = 0xFFFFFF; + static constexpr index_t NULL_INDEX = 0, MAX_INDEX = 0xFFFF; + private: + const index_t index; + const colour_t colour; + Region* region = nullptr; + bool water = false; + life_rating_t life_rating = 0; + IdentifierRegistry<Building> buildings; + + Province(index_t new_index, std::string const& new_identifier, colour_t new_colour); + public: + static std::string colour_to_hex_string(colour_t colour); + + Province(Province&&) = default; + + index_t get_index() const; + colour_t get_colour() const; + Region* get_region() const; + bool is_water() const; + life_rating_t get_life_rating() const; + return_t add_building(BuildingType const& type); + void lock_buildings(); + void reset_buildings(); + std::vector<Building> const& get_buildings() const; + return_t expand_building(std::string const& building_type_identifier); + std::string to_string() const; + + void update_state(Date const& today); + void tick(Date const& today); + }; +} |