aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/TerrainType.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-07-19 21:35:31 +0200
committer GitHub <noreply@github.com>2024-07-19 21:35:31 +0200
commitd1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (patch)
tree38015e5729afbb98cf520e2cf26d8a4623d32f2f /src/openvic-simulation/map/TerrainType.hpp
parente0518bee9b4c164f40716a8033b5e207c2060c0b (diff)
parent03647d2249f72b6545628bb844685f87c4581062 (diff)
Merge pull request #176 from OpenVicProject/format-cleanup
Cleanup: inheritance, const movable variables, code formatting
Diffstat (limited to 'src/openvic-simulation/map/TerrainType.hpp')
-rw-r--r--src/openvic-simulation/map/TerrainType.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/TerrainType.hpp b/src/openvic-simulation/map/TerrainType.hpp
index b534ab5..ec36363 100644
--- a/src/openvic-simulation/map/TerrainType.hpp
+++ b/src/openvic-simulation/map/TerrainType.hpp
@@ -6,11 +6,13 @@
namespace OpenVic {
struct TerrainTypeManager;
- struct TerrainType : HasIdentifierAndColour {
+ // Using HasColour rather than HasIdentifierAndColour to avoid needing virtual inheritance
+ // (extending Modifier is more useful than extending HasIdentifierAndColour).
+ struct TerrainType : Modifier, HasColour {
friend struct TerrainTypeManager;
private:
- const ModifierValue PROPERTY(modifier);
+ ModifierValue PROPERTY(modifier);
const bool PROPERTY(is_water);
TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water);
@@ -26,7 +28,7 @@ namespace OpenVic {
private:
TerrainType const& PROPERTY(type);
- const std::vector<index_t> PROPERTY(terrain_indices);
+ std::vector<index_t> PROPERTY(terrain_indices);
const index_t PROPERTY(priority);
const bool PROPERTY(has_texture);
@@ -42,6 +44,7 @@ namespace OpenVic {
struct TerrainTypeManager {
private:
using terrain_type_mappings_map_t = ordered_map<TerrainTypeMapping::index_t, size_t>;
+
IdentifierRegistry<TerrainType> IDENTIFIER_REGISTRY(terrain_type);
IdentifierRegistry<TerrainTypeMapping> IDENTIFIER_REGISTRY(terrain_type_mapping);
terrain_type_mappings_map_t terrain_type_mappings_map;