diff options
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.cpp')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.cpp | 20 |
1 files changed, 20 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; |