aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic2/map/Map.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-04-26 01:26:33 +0200
committer GitHub <noreply@github.com>2023-04-26 01:26:33 +0200
commit10053cf259c55ee45803268a844edf1011d8a16b (patch)
treefcf86e6fac31430ba537a0d056e97f901ad76dd7 /extension/src/openvic2/map/Map.hpp
parent639f86febf39184cccde9f898fc328375048233f (diff)
parent563834e7e6f9ce565bbfd553a0d9ff80a98c677d (diff)
Merge pull request #98 from OpenVic2Project/some-cleanup
Req comments + cleanup + c++ registry refactoring
Diffstat (limited to 'extension/src/openvic2/map/Map.hpp')
-rw-r--r--extension/src/openvic2/map/Map.hpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/extension/src/openvic2/map/Map.hpp b/extension/src/openvic2/map/Map.hpp
index b6e7ac2..ebc23be 100644
--- a/extension/src/openvic2/map/Map.hpp
+++ b/extension/src/openvic2/map/Map.hpp
@@ -12,13 +12,13 @@ namespace OpenVic2 {
using colour_func_t = std::function<Province::colour_t (Map const&, Province const&)>;
using index_t = size_t;
private:
- index_t index;
- colour_func_t colour_func;
+ const index_t index;
+ const colour_func_t colour_func;
Mapmode(index_t new_index, std::string const& new_identifier, colour_func_t new_colour_func);
public:
index_t get_index() const;
- colour_func_t get_colour_func() const;
+ Province::colour_t get_colour(Map const& map, Province const& province) const;
};
/* REQUIREMENTS:
@@ -26,15 +26,17 @@ namespace OpenVic2 {
*/
struct Map {
private:
- std::vector<Province> provinces;
- std::vector<Region> regions;
- bool provinces_locked = false, water_provinces_locked = false, regions_locked = false;
+ IdentifierRegistry<Province> provinces;
+ IdentifierRegistry<Region> regions;
+ IdentifierRegistry<Mapmode> mapmodes;
+ bool water_provinces_locked = false;
size_t water_province_count = 0;
size_t width = 0, height = 0;
std::vector<Province::index_t> province_index_image;
- std::vector<Mapmode> mapmodes;
public:
+ Map();
+
return_t add_province(std::string const& identifier, Province::colour_t colour);
void lock_provinces();
return_t set_water_province(std::string const& identifier);
@@ -60,12 +62,13 @@ namespace OpenVic2 {
std::vector<Province::index_t> const& get_province_index_image() const;
return_t add_mapmode(std::string const& identifier, Mapmode::colour_func_t colour_func);
+ void lock_mapmodes();
size_t get_mapmode_count() const;
Mapmode const* get_mapmode_by_index(Mapmode::index_t index) const;
Mapmode const* get_mapmode_by_identifier(std::string const& identifier) const;
return_t generate_mapmode_colours(Mapmode::index_t index, uint8_t* target) const;
- void generate_province_buildings(BuildingManager const& manager);
+ return_t generate_province_buildings(BuildingManager const& manager);
void update_state(Date const& today);
void tick(Date const& today);