aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameManager.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-25 01:22:01 +0100
committer hop311 <hop3114@gmail.com>2023-12-25 01:22:01 +0100
commit48204950cd8d48e6df26ed6892f57b3d9da823de (patch)
tree99822c48f16eb1495f7ea9fe669bcb43e7a6001c /src/openvic-simulation/GameManager.cpp
parentbf4e7368600bb425b6612231fbb84de34ec99a27 (diff)
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);