aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-11-07 22:38:07 +0100
committer GitHub <noreply@github.com>2023-11-07 22:38:07 +0100
commitae2742113ec7283a2a5afa62f8bfd98a865c4208 (patch)
tree601591215af0c6724766019ebb577141ea5807c5 /src/openvic-simulation/dataloader/NodeTools.cpp
parent1603fbafb1c03830f38fefd87d8bd0d7d3f135a2 (diff)
parentd30421fa7d7f6ad87d3f90cc0ab491742f0d2548 (diff)
Merge pull request #64 from OpenVicProject/modifier-instance
ModifierEffects stored as instances
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.cpp')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.cpp b/src/openvic-simulation/dataloader/NodeTools.cpp
index 2f93bc2..27d0f95 100644
--- a/src/openvic-simulation/dataloader/NodeTools.cpp
+++ b/src/openvic-simulation/dataloader/NodeTools.cpp
@@ -289,7 +289,7 @@ node_callback_t NodeTools::expect_dictionary(key_value_callback_t callback) {
bool NodeTools::add_key_map_entry(
key_map_t& key_map, std::string_view key, dictionary_entry_t::expected_count_t expected_count, node_callback_t callback
) {
- if (key_map.find(key) == key_map.end()) {
+ if (!key_map.contains(key)) {
key_map.emplace(key, dictionary_entry_t { expected_count, callback });
return true;
}
@@ -318,7 +318,12 @@ key_value_callback_t NodeTools::dictionary_keys_callback(key_map_t& key_map, key
Logger::error("Invalid repeat of dictionary key: ", key);
return false;
}
- return entry.callback(value);
+ if (entry.callback(value)) {
+ return true;
+ } else {
+ Logger::error("Callback failed for dictionary key: ", key);
+ return false;
+ }
};
}