diff options
author | zaaarf <me@zaaarf.foo> | 2023-12-10 21:16:53 +0100 |
---|---|---|
committer | zaaarf <me@zaaarf.foo> | 2023-12-10 21:16:53 +0100 |
commit | 13ffc9a12725b9dbcd3b957c74471356540ee716 (patch) | |
tree | 911563514c661e9bdb5bad1e2c38f200ce4b5428 /src/openvic-simulation/dataloader/Dataloader.cpp | |
parent | ba390fec5a923f7c4b4ab7f85e803eb50bbf9e3a (diff) |
feat: decision dataloading
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; |