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/map/Province.cpp | |
parent | d21255b2ca2fe6cea7f41e88fbb22d138bac74eb (diff) | |
parent | c541a249247b7fe3bdd4c62bce6638e875790f8a (diff) |
Merge pull request #37 from OpenVicProject/dataloading-buildings
Dataloading buildings
Diffstat (limited to 'src/openvic-simulation/map/Province.cpp')
-rw-r--r-- | src/openvic-simulation/map/Province.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index ef574cf..21bdb85 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -1,20 +1,11 @@ #include "Province.hpp" -#include <cassert> -#include <cstddef> -#include <iomanip> -#include <iterator> -#include <sstream> - -#include "openvic-simulation/map/TerrainType.hpp" - using namespace OpenVic; using namespace OpenVic::NodeTools; Province::Province(const std::string_view new_identifier, colour_t new_colour, index_t new_index) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, - index { new_index }, - buildings { "buildings", false } { + index { new_index }, buildings { "buildings", false } { assert(index != NULL_INDEX); } @@ -48,8 +39,8 @@ bool Province::load_positions(BuildingManager const& building_manager, ast::Node return true; } -bool Province::add_building(Building&& building) { - return buildings.add_item(std::move(building)); +bool Province::add_building(BuildingInstance&& building_instance) { + return buildings.add_item(std::move(building_instance)); } void Province::reset_buildings() { @@ -57,7 +48,7 @@ void Province::reset_buildings() { } bool Province::expand_building(const std::string_view building_type_identifier) { - Building* building = buildings.get_item_by_identifier(building_type_identifier); + BuildingInstance* building = buildings.get_item_by_identifier(building_type_identifier); if (building == nullptr) return false; return building->expand(); } @@ -136,13 +127,13 @@ void Province::update_pops() { } void Province::update_state(Date const& today) { - for (Building& building : buildings.get_items()) + for (BuildingInstance& building : buildings.get_items()) building.update_state(today); update_pops(); } void Province::tick(Date const& today) { - for (Building& building : buildings.get_items()) + for (BuildingInstance& building : buildings.get_items()) building.tick(today); } |