From 48204950cd8d48e6df26ed6892f57b3d9da823de Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 25 Dec 2023 00:22:01 +0000 Subject: Province building scaffolding --- src/openvic-simulation/GameManager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/openvic-simulation/GameManager.cpp') 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); -- cgit v1.2.3-56-ga3b1