From efa88c722fcb6c8fea7a86e1b3b8a83f1f59eb31 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 24 Aug 2023 00:32:23 +0100 Subject: Big Dataloader Commit (openvic-simulation) --- src/openvic/map/Building.cpp | 4 ++-- src/openvic/map/Building.hpp | 4 ++-- src/openvic/map/Map.cpp | 7 ++----- src/openvic/map/Map.hpp | 4 +++- src/openvic/map/Province.cpp | 10 ++++++---- src/openvic/map/Province.hpp | 6 +++--- src/openvic/map/Region.cpp | 2 -- src/openvic/map/Region.hpp | 2 +- 8 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src/openvic/map') diff --git a/src/openvic/map/Building.cpp b/src/openvic/map/Building.cpp index 73a1886..d2662c4 100644 --- a/src/openvic/map/Building.cpp +++ b/src/openvic/map/Building.cpp @@ -2,8 +2,8 @@ #include -#include "../utility/Logger.hpp" -#include "Province.hpp" +#include "openvic/utility/Logger.hpp" +#include "openvic/map/Province.hpp" using namespace OpenVic; diff --git a/src/openvic/map/Building.hpp b/src/openvic/map/Building.hpp index c00932b..2ff9409 100644 --- a/src/openvic/map/Building.hpp +++ b/src/openvic/map/Building.hpp @@ -2,8 +2,8 @@ #include -#include "../Date.hpp" -#include "../Types.hpp" +#include "openvic/types/Date.hpp" +#include "openvic/types/IdentifierRegistry.hpp" namespace OpenVic { diff --git a/src/openvic/map/Map.cpp b/src/openvic/map/Map.cpp index d5cfdd2..95d94fd 100644 --- a/src/openvic/map/Map.cpp +++ b/src/openvic/map/Map.cpp @@ -3,8 +3,8 @@ #include #include -#include "../economy/Good.hpp" -#include "../utility/Logger.hpp" +#include "openvic/economy/Good.hpp" +#include "openvic/utility/Logger.hpp" using namespace OpenVic; @@ -403,9 +403,6 @@ return_t Map::setup(GoodManager const& good_manager, BuildingManager const& buil if (!province.is_water() && good_manager.get_good_count() > 0) province.rgo = good_manager.get_good_by_index(province.get_index() % good_manager.get_good_count()); if (building_manager.generate_province_buildings(province) != SUCCESS) ret = FAILURE; - // Add some pops to the province (for testing purposes) - if (!province.is_water()) - pop_manager.generate_test_pops(province); } return ret; } diff --git a/src/openvic/map/Map.hpp b/src/openvic/map/Map.hpp index 1b21f5d..26c07c8 100644 --- a/src/openvic/map/Map.hpp +++ b/src/openvic/map/Map.hpp @@ -2,7 +2,7 @@ #include -#include "Region.hpp" +#include "openvic/map/Region.hpp" namespace OpenVic { @@ -21,6 +21,8 @@ namespace OpenVic { public: static const Mapmode ERROR_MAPMODE; + Mapmode(Mapmode&&) = default; + index_t get_index() const; colour_t get_colour(Map const& map, Province const& province) const; }; diff --git a/src/openvic/map/Province.cpp b/src/openvic/map/Province.cpp index 3de7263..76e478f 100644 --- a/src/openvic/map/Province.cpp +++ b/src/openvic/map/Province.cpp @@ -65,11 +65,13 @@ std::string Province::to_string() const { return stream.str(); } -void Province::add_pop(Pop&& pop) { - if (is_water()) { - Logger::error("Trying to add pop to water province ", get_identifier()); - } else { +return_t Province::add_pop(Pop&& pop) { + if (!is_water()) { pops.push_back(std::move(pop)); + return SUCCESS; + } else { + Logger::error("Trying to add pop to water province ", get_identifier()); + return FAILURE; } } diff --git a/src/openvic/map/Province.hpp b/src/openvic/map/Province.hpp index c2a8ac9..3556bcb 100644 --- a/src/openvic/map/Province.hpp +++ b/src/openvic/map/Province.hpp @@ -1,7 +1,7 @@ #pragma once -#include "../pop/Pop.hpp" -#include "Building.hpp" +#include "openvic/pop/Pop.hpp" +#include "openvic/map/Building.hpp" namespace OpenVic { struct Map; @@ -50,7 +50,7 @@ namespace OpenVic { Good const* get_rgo() const; std::string to_string() const; - void add_pop(Pop&& pop); + return_t add_pop(Pop&& pop); void clear_pops(); Pop::pop_size_t get_total_population() const; distribution_t const& get_pop_type_distribution() const; diff --git a/src/openvic/map/Region.cpp b/src/openvic/map/Region.cpp index fc207e3..8ea45f0 100644 --- a/src/openvic/map/Region.cpp +++ b/src/openvic/map/Region.cpp @@ -1,7 +1,5 @@ #include "Region.hpp" -#include - using namespace OpenVic; return_t ProvinceSet::add_province(Province* province) { diff --git a/src/openvic/map/Region.hpp b/src/openvic/map/Region.hpp index beeb76e..9b5b914 100644 --- a/src/openvic/map/Region.hpp +++ b/src/openvic/map/Region.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Province.hpp" +#include "openvic/map/Province.hpp" namespace OpenVic { -- cgit v1.2.3-56-ga3b1