aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameManager.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-12-25 13:21:38 +0100
committer GitHub <noreply@github.com>2023-12-25 13:21:38 +0100
commitbff91f78f9c5339079c10adfbf8232e5159c1a2d (patch)
treea40b49f6dc155fc5c3c47b623926764642242677 /src/openvic-simulation/GameManager.cpp
parentdcef842d5e070854913f9e61e4a1f485870ae703 (diff)
parent48204950cd8d48e6df26ed6892f57b3d9da823de (diff)
Merge pull request #103 from OpenVicProject/province-buildings
Province building scaffolding
Diffstat (limited to 'src/openvic-simulation/GameManager.cpp')
-rw-r--r--src/openvic-simulation/GameManager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp
index 4d62bc1..0471263 100644
--- a/src/openvic-simulation/GameManager.cpp
+++ b/src/openvic-simulation/GameManager.cpp
@@ -68,14 +68,18 @@ bool GameManager::load_bookmark(Bookmark const* new_bookmark) {
return ret;
}
-bool GameManager::expand_building(Province::index_t province_index, std::string_view building_type_identifier) {
+bool GameManager::expand_selected_province_building(size_t building_index) {
set_needs_update();
- Province* province = map.get_province_by_index(province_index);
+ Province* province = map.get_selected_province();
if (province == nullptr) {
- Logger::error("Invalid province index ", province_index, " while trying to expand building ", building_type_identifier);
+ Logger::error("Cannot expand building index ", building_index, " - no province selected!");
return false;
}
- return province->expand_building(building_type_identifier);
+ if (building_index < 0) {
+ Logger::error("Invalid building index ", building_index, " while trying to expand in province ", province);
+ return false;
+ }
+ return province->expand_building(building_index);
}
static constexpr colour_argb_t::value_type ALPHA_VALUE = colour_argb_t::colour_traits::alpha_from_float(0.7f);