aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/Dataloader.cpp
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-09-28 15:40:34 +0200
committer zaaarf <zaaarf@proton.me>2023-09-28 15:40:34 +0200
commitc541a249247b7fe3bdd4c62bce6638e875790f8a (patch)
tree8fe3545142245d287839728e561d3131fcc30157 /src/openvic-simulation/dataloader/Dataloader.cpp
parent7a8ac1cdb8e71a4166393ac06b1b60512db0ef8c (diff)
feat: implemented building loading and missing parameters
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.cpp')
-rw-r--r--src/openvic-simulation/dataloader/Dataloader.cpp23
1 files changed, 13 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;
}