diff options
Diffstat (limited to 'src/openvic-simulation/map/MapDefinition.cpp')
-rw-r--r-- | src/openvic-simulation/map/MapDefinition.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/openvic-simulation/map/MapDefinition.cpp b/src/openvic-simulation/map/MapDefinition.cpp index 828a679..faea838 100644 --- a/src/openvic-simulation/map/MapDefinition.cpp +++ b/src/openvic-simulation/map/MapDefinition.cpp @@ -3,6 +3,8 @@ #include <cstdint> #include <vector> +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/modifier/ModifierManager.hpp" #include "openvic-simulation/types/Colour.hpp" #include "openvic-simulation/types/OrderedContainers.hpp" #include "openvic-simulation/types/Vector.hpp" @@ -955,7 +957,11 @@ bool MapDefinition::load_climate_file(ModifierManager const& modifier_manager, a Climate* cur_climate = climates.get_item_by_identifier(identifier); if (cur_climate == nullptr) { ModifierValue values; - ret &= modifier_manager.expect_modifier_value(move_variable_callback(values))(node); + + ret &= NodeTools::expect_dictionary( + modifier_manager.expect_base_province_modifier(values) + )(node); + ret &= climates.add_item({ identifier, std::move(values), Modifier::modifier_type_t::CLIMATE }); } else { ret &= expect_list_reserve_length(*cur_climate, expect_province_definition_identifier( @@ -999,6 +1005,7 @@ bool MapDefinition::load_continent_file(ModifierManager const& modifier_manager, bool ret = expect_dictionary_reserve_length( continents, [this, &modifier_manager](std::string_view identifier, ast::NodeCPtr node) -> bool { + if (identifier.empty()) { Logger::error("Invalid continent identifier - empty!"); return false; @@ -1006,7 +1013,8 @@ bool MapDefinition::load_continent_file(ModifierManager const& modifier_manager, ModifierValue values; std::vector<ProvinceDefinition const*> prov_list; - bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(values), + bool ret = NodeTools::expect_dictionary_keys_and_default( + modifier_manager.expect_base_province_modifier(values), "provinces", ONE_EXACTLY, expect_list_reserve_length(prov_list, expect_province_definition_identifier( [&prov_list](ProvinceDefinition const& province) -> bool { if (province.continent == nullptr) { |