diff options
author | Hop311 <Hop3114@gmail.com> | 2023-11-07 22:38:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-07 22:38:07 +0100 |
commit | ae2742113ec7283a2a5afa62f8bfd98a865c4208 (patch) | |
tree | 601591215af0c6724766019ebb577141ea5807c5 /src/openvic-simulation/dataloader/Dataloader.hpp | |
parent | 1603fbafb1c03830f38fefd87d8bd0d7d3f135a2 (diff) | |
parent | d30421fa7d7f6ad87d3f90cc0ab491742f0d2548 (diff) |
Merge pull request #64 from OpenVicProject/modifier-instance
ModifierEffects stored as instances
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.hpp')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.hpp | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp index 0bf3086..2123469 100644 --- a/src/openvic-simulation/dataloader/Dataloader.hpp +++ b/src/openvic-simulation/dataloader/Dataloader.hpp @@ -23,14 +23,16 @@ 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; + bool _load_history(GameManager& game_manager, bool unused_history_file_warnings) const; + + /* _DirIterator is fs::directory_iterator or fs::recursive_directory_iterator. + * _Equiv is an equivalence relation with respect to which every found file shall be unique. + * If a file is equivalent to the empty path then it is not included. */ + template<typename _DirIterator, std::predicate<fs::path const&, fs::path const&> _Equiv> + path_vector_t _lookup_files_in_dir(std::string_view path, fs::path const& extension) const; public: static ovdl::v2script::Parser parse_defines(fs::path const& path); @@ -67,39 +69,31 @@ namespace OpenVic { /* REQUIREMENTS: * DAT-24 */ - fs::path lookup_file(fs::path const& path) const; - path_vector_t lookup_files_in_dir(fs::path const& path, fs::path const& extension) const; - bool apply_to_files_in_dir( - fs::path const& path, fs::path const& extension, NodeTools::callback_t<fs::path const&> callback + fs::path lookup_file(std::string_view path, bool print_error = true) const; + path_vector_t lookup_files_in_dir(std::string_view path, fs::path const& extension) const; + path_vector_t lookup_files_in_dir_recursive(std::string_view path, fs::path const& extension) const; + path_vector_t lookup_basic_indentifier_prefixed_files_in_dir(std::string_view path, fs::path const& extension) const; + path_vector_t lookup_basic_indentifier_prefixed_files_in_dir_recursive( + std::string_view path, fs::path const& extension ) const; + bool apply_to_files(path_vector_t const& files, NodeTools::callback_t<fs::path const&> callback) const; bool load_defines(GameManager& game_manager) const; - bool load_pop_history(GameManager& game_manager, fs::path const& path) const; + bool load_pop_history(GameManager& game_manager, std::string_view path) const; enum locale_t : size_t { - English, - French, - German, - Polish, - Spanish, - Italian, - Swedish, - Czech, - Hungarian, - Dutch, - Portugese, - Russian, - Finnish, - _LocaleCount + English, French, German, Polish, Spanish, Italian, Swedish, + Czech, Hungarian, Dutch, Portugese, Russian, Finnish, _LocaleCount + }; + static constexpr char const* locale_names[_LocaleCount] = { + "en_GB", "fr_FR", "de_DE", "pl_PL", "es_ES", "it_IT", "sv_SE", + "cs_CZ", "hu_HU", "nl_NL", "pt_PT", "ru_RU", "fi_FI" }; - static constexpr char const* locale_names[_LocaleCount] = { "en_GB", "fr_FR", "de_DE", "pl_PL", "es_ES", - "it_IT", "sv_SE", "cs_CZ", "hu_HU", "nl_NL", - "pt_PT", "ru_RU", "fi_FI" }; /* Args: key, locale, localisation */ using localisation_callback_t = NodeTools::callback_t<std::string_view, locale_t, std::string_view>; bool load_localisation_files( - localisation_callback_t callback, fs::path const& localisation_dir = "localisation" + localisation_callback_t callback, std::string_view localisation_dir = "localisation" ) const; private: @@ -111,6 +105,6 @@ namespace OpenVic { using hint_path_t = fs::path; using game_path_t = fs::path; - inline static std::unordered_map<hint_path_t, game_path_t, fshash> _cached_paths; + static inline std::unordered_map<hint_path_t, game_path_t, fshash> _cached_paths; }; } |