diff options
author | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
commit | c0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (patch) | |
tree | ebc9c03b5bd0a6b11068ac37aca302f6ceb24a18 /src/openvic-simulation/map/Mapmode.cpp | |
parent | 1198a780916e65cae048dd3478f614c1d18db846 (diff) |
Add GoodInstancegood-instance
Diffstat (limited to 'src/openvic-simulation/map/Mapmode.cpp')
-rw-r--r-- | src/openvic-simulation/map/Mapmode.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/Mapmode.cpp b/src/openvic-simulation/map/Mapmode.cpp index 6f8e606..410ea2b 100644 --- a/src/openvic-simulation/map/Mapmode.cpp +++ b/src/openvic-simulation/map/Mapmode.cpp @@ -142,8 +142,8 @@ static constexpr auto shaded_mapmode(fixed_point_map_t<T const*> const&(Province bool MapmodeManager::setup_mapmodes() { bool ret = true; - using mapmode_t = std::pair<std::string, Mapmode::colour_func_t>; - const std::vector<mapmode_t> mapmodes { + using mapmode_definition_t = std::pair<std::string, Mapmode::colour_func_t>; + const std::vector<mapmode_definition_t> mapmode_definitions { { "mapmode_terrain", [](MapInstance const&, ProvinceInstance const& province) -> Mapmode::base_stripe_t { @@ -284,9 +284,13 @@ bool MapmodeManager::setup_mapmodes() { } }; - for (mapmode_t const& mapmode : mapmodes) { + mapmodes.reset(); + reserve_mapmodes(mapmode_definitions.size()); + + for (mapmode_definition_t const& mapmode : mapmode_definitions) { ret &= add_mapmode(mapmode.first, mapmode.second); } + lock_mapmodes(); return ret; |