diff options
author | zaaarf <zaaarf@proton.me> | 2023-09-28 13:16:17 +0200 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-09-28 13:16:17 +0200 |
commit | 7a8ac1cdb8e71a4166393ac06b1b60512db0ef8c (patch) | |
tree | f02b24cd02410fef692b956932b2cb0a09fb9670 /src/openvic-simulation/GameManager.cpp | |
parent | 33a2a1e5fcac60ddd0f2840449488e48069493ec (diff) |
feat: renamed Building to BuildingInstance, implemented Building and BuildingType defines
Diffstat (limited to 'src/openvic-simulation/GameManager.cpp')
-rw-r--r-- | src/openvic-simulation/GameManager.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp index d9dc3d9..958049d 100644 --- a/src/openvic-simulation/GameManager.cpp +++ b/src/openvic-simulation/GameManager.cpp @@ -177,12 +177,12 @@ bool GameManager::load_hardcoded_defines() { } }, { "mapmode_infrastructure", [](Map const& map, Province const& province) -> colour_t { - Building const* railroad = province.get_building_by_identifier("building_railroad"); + BuildingInstance const* railroad = province.get_building_by_identifier("building_railroad"); if (railroad != nullptr) { - colour_t val = fraction_to_colour_byte(railroad->get_level(), railroad->get_type().get_max_level() + 1, 0.5f, 1.0f); + colour_t val = fraction_to_colour_byte(railroad->get_current_level(), railroad->get_building().get_max_level() + 1, 0.5f, 1.0f); switch (railroad->get_expansion_state()) { - case Building::ExpansionState::CannotExpand: val <<= 16; break; - case Building::ExpansionState::CanExpand: break; + case ExpansionState::CannotExpand: val <<= 16; break; + case ExpansionState::CanExpand: break; default: val <<= 8; break; } return HIGH_ALPHA_VALUE | val; @@ -208,13 +208,5 @@ bool GameManager::load_hardcoded_defines() { ret &= map.add_mapmode(mapmode.first, mapmode.second); map.lock_mapmodes(); - using building_type_t = std::tuple<std::string, Building::level_t, Timespan>; - const std::vector<building_type_t> building_types { - { "building_fort", 4, 8 }, { "building_naval_base", 6, 15 }, { "building_railroad", 5, 10 } // Move this to building.hpp - }; - for (building_type_t const& type : building_types) - ret &= building_manager.add_building_type(std::get<0>(type), std::get<1>(type), std::get<2>(type)); - building_manager.lock_building_types(); - return ret; } |