aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/history')
-rw-r--r--src/openvic-simulation/history/CountryHistory.cpp12
-rw-r--r--src/openvic-simulation/history/CountryHistory.hpp3
2 files changed, 13 insertions, 2 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);
}
}
diff --git a/src/openvic-simulation/history/CountryHistory.hpp b/src/openvic-simulation/history/CountryHistory.hpp
index d6a6997..04de653 100644
--- a/src/openvic-simulation/history/CountryHistory.hpp
+++ b/src/openvic-simulation/history/CountryHistory.hpp
@@ -2,6 +2,7 @@
#include <optional>
+#include "openvic-simulation/country/CountryInstance.hpp"
#include "openvic-simulation/history/HistoryMap.hpp"
#include "openvic-simulation/types/Date.hpp"
#include "openvic-simulation/types/fixed_point/FixedPointMap.hpp"
@@ -46,7 +47,7 @@ namespace OpenVic {
ordered_set<Reform const*> PROPERTY(reforms);
std::optional<Deployment const*> PROPERTY(inital_oob);
std::optional<TechnologySchool const*> PROPERTY(tech_school);
- ordered_map<Technology const*, bool> PROPERTY(technologies);
+ ordered_map<Technology const*, CountryInstance::unlock_level_t> PROPERTY(technologies);
ordered_map<Invention const*, bool> PROPERTY(inventions);
fixed_point_map_t<CountryDefinition const*> PROPERTY(foreign_investment);
std::optional<fixed_point_t> PROPERTY(consciousness);