diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-28 20:51:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 20:51:56 +0200 |
commit | ae0be2a8d2e1b717f6c4a4617096f17089ce8701 (patch) | |
tree | 897742b074547e4d1694ddff1f4e9e8f14d82d6a /src/openvic-simulation/dataloader | |
parent | d21255b2ca2fe6cea7f41e88fbb22d138bac74eb (diff) | |
parent | c541a249247b7fe3bdd4c62bce6638e875790f8a (diff) |
Merge pull request #37 from OpenVicProject/dataloading-buildings
Dataloading buildings
Diffstat (limited to 'src/openvic-simulation/dataloader')
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.cpp | 23 | ||||
-rw-r--r-- | src/openvic-simulation/dataloader/Dataloader.hpp | 5 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.cpp b/src/openvic-simulation/dataloader/Dataloader.cpp index 530aa76..c21c6da 100644 --- a/src/openvic-simulation/dataloader/Dataloader.cpp +++ b/src/openvic-simulation/dataloader/Dataloader.cpp @@ -1,12 +1,5 @@ #include "Dataloader.hpp" -#include <openvic-dataloader/csv/Parser.hpp> -#include <openvic-dataloader/detail/CallbackOStream.hpp> -#include <openvic-dataloader/v2script/Parser.hpp> - -#include "openvic-simulation/GameManager.hpp" -#include "openvic-simulation/utility/Logger.hpp" - using namespace OpenVic; using namespace OpenVic::NodeTools; using namespace ovdl; @@ -282,6 +275,7 @@ bool Dataloader::load_defines(GameManager& game_manager) const { static const fs::path ideology_file = "common/ideologies.txt"; static const fs::path issues_file = "common/issues.txt"; static const fs::path production_types_file = "common/production_types.txt"; + static const fs::path buildings_file = "common/buildings.txt"; static const fs::path map_directory = "map"; static const fs::path units_directory = "units"; @@ -320,19 +314,28 @@ bool Dataloader::load_defines(GameManager& game_manager) const { ret = false; } if (!game_manager.get_production_type_manager().load_production_types_file( - game_manager.get_good_manager(), game_manager.get_pop_manager(), + game_manager.get_good_manager(), + game_manager.get_pop_manager(), _parse_defines(lookup_file(production_types_file)).get_file_node())) { Logger::error("Failed to load production types!"); ret = false; } - if (!_load_units(game_manager, units_directory)) { - Logger::error("Failed to load units!"); + if (!game_manager.get_building_manager().load_buildings_file( + game_manager.get_good_manager(), + game_manager.get_production_type_manager(), + game_manager.get_modifier_manager(), + _parse_defines(lookup_file(buildings_file)).get_file_node())) { + Logger::error("Failed to load buildings!"); ret = false; } if (!_load_map_dir(game_manager, map_directory)) { Logger::error("Failed to load map!"); ret = false; } + if (!_load_units(game_manager, units_directory)) { + Logger::error("Failed to load units!"); + ret = false; + } return ret; } diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp index e935091..e1a2614 100644 --- a/src/openvic-simulation/dataloader/Dataloader.hpp +++ b/src/openvic-simulation/dataloader/Dataloader.hpp @@ -5,6 +5,11 @@ #include <vector> #include "openvic-simulation/dataloader/NodeTools.hpp" +#include <openvic-dataloader/csv/Parser.hpp> +#include <openvic-dataloader/detail/CallbackOStream.hpp> +#include <openvic-dataloader/v2script/Parser.hpp> +#include "openvic-simulation/GameManager.hpp" +#include "openvic-simulation/utility/Logger.hpp" namespace OpenVic { namespace fs = std::filesystem; |