aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r--src/openvic-simulation/map/Map.cpp12
-rw-r--r--src/openvic-simulation/map/Map.hpp7
-rw-r--r--src/openvic-simulation/map/Province.cpp3
-rw-r--r--src/openvic-simulation/map/Province.hpp1
-rw-r--r--src/openvic-simulation/map/TerrainType.cpp1
5 files changed, 5 insertions, 19 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp
index 549e539..f854cab 100644
--- a/src/openvic-simulation/map/Map.cpp
+++ b/src/openvic-simulation/map/Map.cpp
@@ -141,14 +141,6 @@ bool Map::add_region(std::string_view identifier, std::vector<std::string_view>
return ret;
}
-Province* Map::get_province_by_index(Province::index_t index) {
- return index != Province::NULL_INDEX ? provinces.get_item_by_index(index - 1) : nullptr;
-}
-
-Province const* Map::get_province_by_index(Province::index_t index) const {
- return index != Province::NULL_INDEX ? provinces.get_item_by_index(index - 1) : nullptr;
-}
-
Province::index_t Map::get_index_from_colour(colour_t colour) const {
const colour_index_map_t::const_iterator it = colour_index_map.find(colour);
if (it != colour_index_map.end()) {
@@ -229,10 +221,6 @@ bool Map::add_mapmode(std::string_view identifier, Mapmode::colour_func_t colour
return mapmodes.add_item({ identifier, mapmodes.size(), colour_func });
}
-Mapmode const* Map::get_mapmode_by_index(size_t index) const {
- return mapmodes.get_item_by_index(index);
-}
-
bool Map::generate_mapmode_colours(Mapmode::index_t index, uint8_t* target) const {
if (target == nullptr) {
Logger::error("Mapmode colour target pointer is null!");
diff --git a/src/openvic-simulation/map/Map.hpp b/src/openvic-simulation/map/Map.hpp
index 0999145..638d7a5 100644
--- a/src/openvic-simulation/map/Map.hpp
+++ b/src/openvic-simulation/map/Map.hpp
@@ -73,15 +73,13 @@ namespace OpenVic {
Map();
bool add_province(std::string_view identifier, colour_t colour);
- IDENTIFIER_REGISTRY_ACCESSORS(province)
- IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS(province)
+ IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_INDEX_OFFSET(province, 1)
+ IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS_CUSTOM_INDEX_OFFSET(province, 1);
bool set_water_province(std::string_view identifier);
bool set_water_province_list(std::vector<std::string_view> const& list);
void lock_water_provinces();
- Province* get_province_by_index(Province::index_t index);
- Province const* get_province_by_index(Province::index_t index) const;
Province::index_t get_province_index_at(size_t x, size_t y) const;
bool set_max_provinces(Province::index_t new_max_provinces);
Province::index_t get_max_provinces() const;
@@ -99,7 +97,6 @@ namespace OpenVic {
bool add_mapmode(std::string_view identifier, Mapmode::colour_func_t colour_func);
IDENTIFIER_REGISTRY_ACCESSORS(mapmode)
- Mapmode const* get_mapmode_by_index(size_t index) const;
/* The mapmode colour image contains of a list of base colours and stripe colours. Each colour is four bytes
* in RGBA format, with the alpha value being used to interpolate with the terrain colour, so A = 0 is fully terrain
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp
index c2d2da0..193b1f9 100644
--- a/src/openvic-simulation/map/Province.cpp
+++ b/src/openvic-simulation/map/Province.cpp
@@ -10,7 +10,8 @@ Province::Province(
) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, index { new_index },
region { nullptr }, on_map { false }, has_region { false }, water { false }, default_terrain_type { nullptr },
terrain_type { nullptr }, life_rating { 0 }, colony_status { colony_status_t::STATE }, owner { nullptr },
- controller { nullptr }, slave { false }, buildings { "buildings", false }, rgo { nullptr }, total_population { 0 } {
+ controller { nullptr }, slave { false }, crime { nullptr }, rgo { nullptr }, buildings { "buildings", false },
+ total_population { 0 } {
assert(index != NULL_INDEX);
}
diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp
index af0bed4..a57f914 100644
--- a/src/openvic-simulation/map/Province.hpp
+++ b/src/openvic-simulation/map/Province.hpp
@@ -78,6 +78,7 @@ namespace OpenVic {
Country const* PROPERTY(controller);
std::vector<Country const*> PROPERTY(cores);
bool PROPERTY(slave);
+ Crime const* PROPERTY_RW(crime);
// TODO - change this into a factory-like structure
Good const* PROPERTY(rgo);
IdentifierRegistry<BuildingInstance> buildings;
diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp
index 3048b66..ae10474 100644
--- a/src/openvic-simulation/map/TerrainType.cpp
+++ b/src/openvic-simulation/map/TerrainType.cpp
@@ -10,7 +10,6 @@ TerrainType::TerrainType(
) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, modifier { std::move(new_modifier) },
is_water { new_is_water } {}
-
TerrainTypeMapping::TerrainTypeMapping(
std::string_view new_identifier, TerrainType const& new_type, std::vector<index_t>&& new_terrain_indicies,
index_t new_priority, bool new_has_texture