diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-09 23:49:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 23:49:54 +0200 |
commit | 6278a35f4704574933464700026d8deb997da5c1 (patch) | |
tree | eb36a9b030b263d825eb93638e64deb0dbd38a78 /src/openvic-simulation/dataloader/Dataloader.hpp | |
parent | bec619fc8f554cb075fcef2428f3b6bdb5e88e82 (diff) | |
parent | 3d7fbd9b376811ca0ed226fa78bcc8b6279ba8dc (diff) |
Merge pull request #14 from OpenVicProject/dataloading
Dataloading scaffolding + basic culture and pop history loading
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.hpp')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp new file mode 100644 index 0000000..efada89 --- /dev/null +++ b/src/openvic-simulation/dataloader/Dataloader.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include <filesystem> +#include <functional> +#include <vector> + +namespace OpenVic { + namespace fs = std::filesystem; + + struct GameManager; + struct PopManager; + struct Map; + + class Dataloader { + public: + using path_vector_t = std::vector<fs::path>; + + private: + path_vector_t roots; + + bool _load_pop_types(PopManager& pop_manager, fs::path const& pop_type_directory) const; + bool _load_map_dir(Map& map, fs::path const& map_directory) const; + + public: + Dataloader() = default; + + /* In reverse-load order, so base defines first and final loaded mod last */ + bool set_roots(path_vector_t new_roots); + + fs::path lookup_file(fs::path const& path) const; + static const fs::path TXT; + path_vector_t lookup_files_in_dir(fs::path const& path, fs::path const* extension = &TXT) const; + bool apply_to_files_in_dir(fs::path const& path, std::function<bool(fs::path const&)> callback, + fs::path const* extension = &TXT) const; + + bool load_defines(GameManager& game_manager) const; + bool load_pop_history(GameManager& game_manager, fs::path const& path) const; + }; +} |