diff options
author | Hop311 <Hop3114@gmail.com> | 2023-04-23 20:52:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 20:52:33 +0200 |
commit | 7f433fe019310ecfd1d1c46afd97cbfcb210c88f (patch) | |
tree | 60971db586e78761341f2b48110d149b1ba0db9d /extension/src/openvic2/map/Province.hpp | |
parent | c041b291c887db90a4e1112ffdd1e56865c27b13 (diff) | |
parent | d3f3187209cb4085f27f95ce8ad2a77af25704fd (diff) |
Merge pull request #94 from OpenVic2Project/province-buildings
Province buildings
Diffstat (limited to 'extension/src/openvic2/map/Province.hpp')
-rw-r--r-- | extension/src/openvic2/map/Province.hpp | 45 |
1 files changed, 45 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..79c6861 --- /dev/null +++ b/extension/src/openvic2/map/Province.hpp @@ -0,0 +1,45 @@ +#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: + index_t index; + colour_t colour; + Region* region = nullptr; + bool water = false; + life_rating_t life_rating = 0; + std::vector<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); + + 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; + 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); + }; +} |