From 7a8ac1cdb8e71a4166393ac06b1b60512db0ef8c Mon Sep 17 00:00:00 2001 From: zaaarf Date: Thu, 28 Sep 2023 13:16:17 +0200 Subject: feat: renamed Building to BuildingInstance, implemented Building and BuildingType defines --- src/openvic-simulation/map/Province.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/openvic-simulation/map/Province.cpp') 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 -#include -#include -#include -#include - -#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); } -- cgit v1.2.3-56-ga3b1