diff options
author | Hop311 <Hop3114@gmail.com> | 2023-12-25 13:21:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-25 13:21:38 +0100 |
commit | bff91f78f9c5339079c10adfbf8232e5159c1a2d (patch) | |
tree | a40b49f6dc155fc5c3c47b623926764642242677 /src/openvic-simulation/map/Province.cpp | |
parent | dcef842d5e070854913f9e61e4a1f485870ae703 (diff) | |
parent | 48204950cd8d48e6df26ed6892f57b3d9da823de (diff) |
Merge pull request #103 from OpenVicProject/province-buildings
Province building scaffolding
Diffstat (limited to 'src/openvic-simulation/map/Province.cpp')
-rw-r--r-- | src/openvic-simulation/map/Province.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index 79a6202..cb9095b 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -58,9 +58,10 @@ bool Province::load_positions(BuildingTypeManager const& building_type_manager, return ret; } -bool Province::expand_building(std::string_view building_type_identifier) { - BuildingInstance* building = buildings.get_item_by_identifier(building_type_identifier); +bool Province::expand_building(size_t building_index) { + BuildingInstance* building = buildings.get_item_by_index(building_index); if (building == nullptr) { + Logger::error("Trying to expand non-existent building index ", building_index, " in province ", get_identifier()); return false; } return building->expand(); @@ -360,10 +361,8 @@ bool Province::reset(BuildingTypeManager const& building_type_manager) { bool ret = true; if (!is_water()) { if (building_type_manager.building_types_are_locked()) { - for (BuildingType const& building_type : building_type_manager.get_building_types()) { - if (building_type.get_in_province()) { - ret &= buildings.add_item({ building_type }); - } + for (BuildingType const* building_type : building_type_manager.get_province_building_types()) { + ret &= buildings.add_item({ *building_type }); } } else { Logger::error("Cannot generate buildings until building types are locked!"); |