aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/ProvinceHistory.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-24 01:47:16 +0100
committer GitHub <noreply@github.com>2024-01-24 01:47:16 +0100
commit6bcb1e70a15755ceb0aaa13a080f85f8edb50911 (patch)
treeb30e9b5774130552fe97e27deaf0370d83920c43 /src/openvic-simulation/history/ProvinceHistory.cpp
parentd4e597da089a81f719a9c33b46111d1c2c590124 (diff)
parent268a6948c0400905dfc335427395519689f067f5 (diff)
Merge pull request #137 from OpenVicProject/reserve_more
Added reserve_more, expect_dictionary_key[s|_map]_reserve_length[_and_default]
Diffstat (limited to 'src/openvic-simulation/history/ProvinceHistory.cpp')
-rw-r--r--src/openvic-simulation/history/ProvinceHistory.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/openvic-simulation/history/ProvinceHistory.cpp b/src/openvic-simulation/history/ProvinceHistory.cpp
index fd174a3..b5b2210 100644
--- a/src/openvic-simulation/history/ProvinceHistory.cpp
+++ b/src/openvic-simulation/history/ProvinceHistory.cpp
@@ -112,6 +112,14 @@ bool ProvinceHistoryMap::_load_history_entry(
)(root);
}
+void ProvinceHistoryManager::reserve_more_province_histories(size_t size) {
+ if (locked) {
+ Logger::error("Failed to reserve space for ", size, " provinces in ProvinceHistoryManager - already locked!");
+ } else {
+ reserve_more(province_histories, size);
+ }
+}
+
void ProvinceHistoryManager::lock_province_histories(Map const& map, bool detailed_errors) {
std::vector<bool> province_checklist(map.get_province_count());
for (decltype(province_histories)::value_type const& entry : province_histories) {