aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/CountryHistory.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-14 21:37:10 +0200
committer GitHub <noreply@github.com>2024-09-14 21:37:10 +0200
commitd8c04cbe53188d4717f8c49f918e01657dbf3440 (patch)
tree7754de92a23f21e0546dcd09439bf0d3962b096f /src/openvic-simulation/history/CountryHistory.cpp
parent7a9206e3869fbb659d296b854c90f5c81755a5ca (diff)
parenta424969548083a977480a6be0f078760a5789bbf (diff)
Merge pull request #197 from OpenVicProject/country-unlock
CountryInstance unlock tech, invention, crime, building, unit, gas etc.
Diffstat (limited to 'src/openvic-simulation/history/CountryHistory.cpp')
-rw-r--r--src/openvic-simulation/history/CountryHistory.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/openvic-simulation/history/CountryHistory.cpp b/src/openvic-simulation/history/CountryHistory.cpp
index 04f6292..cd51e19 100644
--- a/src/openvic-simulation/history/CountryHistory.cpp
+++ b/src/openvic-simulation/history/CountryHistory.cpp
@@ -54,7 +54,17 @@ bool CountryHistoryMap::_load_history_entry(
{
Technology const* technology = technology_manager.get_technology_by_identifier(key);
if (technology != nullptr) {
- return expect_int_bool(map_callback(entry.technologies, technology))(value);
+ return expect_uint<decltype(entry.technologies)::mapped_type>(
+ [&entry, technology](decltype(entry.technologies)::mapped_type value) -> bool {
+ if (value > 1) {
+ Logger::warning(
+ "Technology ", technology->get_identifier(),
+ " is applied multiple times in history of country ", entry.get_country().get_identifier()
+ );
+ }
+ return map_callback(entry.technologies, technology)(value);
+ }
+ )(value);
}
}