aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/dataloader')
-rw-r--r--src/openvic-simulation/dataloader/Dataloader.cpp20
-rw-r--r--src/openvic-simulation/dataloader/Dataloader.hpp1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.cpp b/src/openvic-simulation/dataloader/Dataloader.cpp
index 8c6704b..f49ae2d 100644
--- a/src/openvic-simulation/dataloader/Dataloader.cpp
+++ b/src/openvic-simulation/dataloader/Dataloader.cpp
@@ -428,6 +428,22 @@ bool Dataloader::_load_inventions(GameManager& game_manager) const {
return ret;
}
+bool Dataloader::_load_decisions(GameManager& game_manager) const {
+ static constexpr std::string_view decisions_directory = "decisions";
+ DecisionManager& decision_manager = game_manager.get_decision_manager();
+
+ bool ret = apply_to_files(
+ lookup_files_in_dir(decisions_directory, ".txt"),
+ [&decision_manager](fs::path const& file) -> bool {
+ return decision_manager.load_decision_file(parse_defines(file).get_file_node());
+ }
+ );
+
+ decision_manager.lock_decisions();
+
+ return ret;
+}
+
bool Dataloader::_load_history(GameManager& game_manager, bool unused_history_file_warnings) const {
/* Country History */
@@ -805,6 +821,10 @@ bool Dataloader::load_defines(GameManager& game_manager) const {
Logger::error("Failed to load countries!");
ret = false;
}
+ if (!_load_decisions(game_manager)) {
+ Logger::error("Failde to load decisions!");
+ ret = false;
+ }
if (!_load_history(game_manager, false)) {
Logger::error("Failed to load history!");
ret = false;
diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp
index 884588a..78021b3 100644
--- a/src/openvic-simulation/dataloader/Dataloader.hpp
+++ b/src/openvic-simulation/dataloader/Dataloader.hpp
@@ -32,6 +32,7 @@ namespace OpenVic {
bool _load_inventions(GameManager& game_manager) const;
bool _load_events(GameManager& game_manager) const;
bool _load_map_dir(GameManager& game_manager) const;
+ bool _load_decisions(GameManager& game_manager) const;
bool _load_history(GameManager& game_manager, bool unused_history_file_warnings) const;
/* _DirIterator is fs::directory_iterator or fs::recursive_directory_iterator. _UniqueKey is the type of a callable