diff options
author | hop311 <hop3114@gmail.com> | 2023-10-29 23:16:14 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-11-07 19:32:43 +0100 |
commit | 8a00697a0e6a4168894594eadc373836a1689eea (patch) | |
tree | a8af4d6c77764644305be324b32b96b9c272e563 /src/openvic-simulation/dataloader | |
parent | 61e5c971cd371950a3bd659799208d8143dddd4f (diff) |
Country: datatypes + TGC compat changes
Diffstat (limited to 'src/openvic-simulation/dataloader')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.cpp | 30 | ||||
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.hpp | 5 |
2 files changed, 5 insertions, 30 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.cpp b/src/openvic-simulation/dataloader/Dataloader.cpp index 5301aa1..0094253 100644 --- a/src/openvic-simulation/dataloader/Dataloader.cpp +++ b/src/openvic-simulation/dataloader/Dataloader.cpp @@ -534,31 +534,6 @@ bool Dataloader::_load_oobs(GameManager& game_manager) const { return ret; } -bool Dataloader::_load_countries(GameManager& game_manager) const { - static const fs::path countries_file = "common/countries.txt"; - - bool is_dynamic = false; - - bool ret = expect_dictionary([this, &game_manager, &is_dynamic](std::string_view key, ast::NodeCPtr value) -> bool { - if (key == "dynamic_tags") { - return expect_bool(assign_variable_callback(is_dynamic))(value); - } - - std::string_view data_path; - - if (!expect_string(assign_variable_callback(data_path))(value)) { - return false; - } - - return game_manager.get_country_manager().load_country_data_file( - game_manager, key, is_dynamic, parse_defines(lookup_file(countries_file.parent_path() / data_path)).get_file_node() - ); - })(parse_defines(lookup_file(countries_file)).get_file_node()); - game_manager.get_country_manager().lock_countries(); - - return ret; -} - bool Dataloader::_load_history(GameManager& game_manager) const { static const fs::path country_history_directory = "history/countries"; static const fs::path province_history_directory = "history/provinces"; @@ -724,6 +699,7 @@ bool Dataloader::load_defines(GameManager& game_manager) const { static const fs::path defines_file = "common/defines.lua"; static const fs::path buildings_file = "common/buildings.txt"; static const fs::path bookmark_file = "common/bookmarks.txt"; + static const fs::path countries_file = "common/countries.txt"; static const fs::path culture_file = "common/cultures.txt"; static const fs::path goods_file = "common/goods.txt"; static const fs::path governments_file = "common/governments.txt"; @@ -836,7 +812,9 @@ bool Dataloader::load_defines(GameManager& game_manager) const { Logger::error("Failed to load orders of battle!"); ret = false; } - if (!_load_countries(game_manager)) { + if (!game_manager.get_country_manager().load_countries( + game_manager, *this, countries_file.parent_path(), parse_defines(lookup_file(countries_file)).get_file_node() + )) { Logger::error("Failed to load countries!"); ret = false; } diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp index 0bf3086..508bf13 100644 --- a/src/openvic-simulation/dataloader/Dataloader.hpp +++ b/src/openvic-simulation/dataloader/Dataloader.hpp @@ -23,13 +23,10 @@ namespace OpenVic { private: path_vector_t roots; - bool _load_pop_types( - PopManager& pop_manager, UnitManager const& unit_manager, GoodManager const& good_manager - ) const; + bool _load_pop_types(PopManager& pop_manager, UnitManager const& unit_manager, GoodManager const& good_manager) const; bool _load_units(UnitManager& unit_manager, GoodManager const& good_manager) const; bool _load_map_dir(GameManager& game_manager) const; bool _load_oobs(GameManager& game_manager) const; - bool _load_countries(GameManager& game_manager) const; bool _load_history(GameManager& game_manager) const; public: |