diff options
author | BrickPi <49528459+BrickPi@users.noreply.github.com> | 2023-11-08 21:41:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 21:41:43 +0100 |
commit | 6713ab633b130da6ade5df60cb94a1b22c593d21 (patch) | |
tree | d2d812bd80bc8530889230a9dfc58df8f3c37915 /src/openvic-simulation/dataloader | |
parent | ae2742113ec7283a2a5afa62f8bfd98a865c4208 (diff) | |
parent | 67d7a855992ab25ff2c47b12860c2eb7c9241ae2 (diff) |
Merge pull request #70 from OpenVicProject/diplomacy-basics
Diplomacy History
Diffstat (limited to 'src/openvic-simulation/dataloader')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.cpp b/src/openvic-simulation/dataloader/Dataloader.cpp index 6911de5..aefb6fc 100644 --- a/src/openvic-simulation/dataloader/Dataloader.cpp +++ b/src/openvic-simulation/dataloader/Dataloader.cpp @@ -639,6 +639,22 @@ bool Dataloader::_load_history(GameManager& game_manager, bool unused_history_fi ); game_manager.get_history_manager().get_province_manager().lock_province_histories(game_manager.get_map(), false); + static constexpr std::string_view diplomacy_history_directory = "history/diplomacy"; + ret &= apply_to_files( + lookup_files_in_dir(diplomacy_history_directory, ".txt"), + [this, &game_manager](fs::path const& file) -> bool { + return game_manager.get_history_manager().get_diplomacy_manager().load_diplomacy_history_file(game_manager, parse_defines(file).get_file_node()); + } + ); + static constexpr std::string_view war_history_directory = "history/wars"; + ret &= apply_to_files( + lookup_files_in_dir(war_history_directory, ".txt"), + [this, &game_manager](fs::path const& file) -> bool { + return game_manager.get_history_manager().get_diplomacy_manager().load_war_history_file(game_manager, parse_defines(file).get_file_node()); + } + ); + game_manager.get_history_manager().get_diplomacy_manager().lock_diplomatic_history(); + return ret; } @@ -778,6 +794,7 @@ bool Dataloader::load_defines(GameManager& game_manager) const { static const std::string production_types_file = "common/production_types.txt"; static const std::string religion_file = "common/religion.txt"; static const std::string leader_traits_file = "common/traits.txt"; + static const std::string cb_types_file = "common/cb_types.txt"; bool ret = true; @@ -872,6 +889,10 @@ bool Dataloader::load_defines(GameManager& game_manager) const { Logger::error("Failed to load leader traits!"); ret = false; } + if (!game_manager.get_military_manager().get_wargoal_manager().load_wargoal_file(parse_defines(lookup_file(cb_types_file)).get_file_node())) { + Logger::error("Failed to load wargoals!"); + ret = false; + } if (!game_manager.get_history_manager().load_bookmark_file(parse_defines(lookup_file(bookmark_file)).get_file_node())) { Logger::error("Failed to load bookmarks!"); ret = false; |