diff options
author | hop311 <hop3114@gmail.com> | 2023-12-25 01:22:01 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-12-25 01:22:01 +0100 |
commit | 48204950cd8d48e6df26ed6892f57b3d9da823de (patch) | |
tree | 99822c48f16eb1495f7ea9fe669bcb43e7a6001c /src/openvic-simulation/economy/BuildingInstance.cpp | |
parent | bf4e7368600bb425b6612231fbb84de34ec99a27 (diff) |
Province building scaffolding
Diffstat (limited to 'src/openvic-simulation/economy/BuildingInstance.cpp')
-rw-r--r-- | src/openvic-simulation/economy/BuildingInstance.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/openvic-simulation/economy/BuildingInstance.cpp b/src/openvic-simulation/economy/BuildingInstance.cpp index 597b89e..047b759 100644 --- a/src/openvic-simulation/economy/BuildingInstance.cpp +++ b/src/openvic-simulation/economy/BuildingInstance.cpp @@ -4,7 +4,7 @@ using namespace OpenVic; BuildingInstance::BuildingInstance(BuildingType const& new_building_type, level_t new_level) : HasIdentifier { new_building_type.get_identifier() }, building_type { new_building_type }, level { new_level }, - expansion_state { ExpansionState::CannotExpand } {} + expansion_state { ExpansionState::CannotExpand }, start_date {}, end_date {}, expansion_progress { 0.0f } {} bool BuildingInstance::_can_expand() const { return level < building_type.get_max_level(); @@ -29,7 +29,8 @@ void BuildingInstance::update_state(Date today) { end_date = start_date + building_type.get_build_time(); break; case ExpansionState::Expanding: - expansion_progress = static_cast<double>(today - start_date) / static_cast<double>(end_date - start_date); + expansion_progress = + static_cast<float>((today - start_date).to_int()) / static_cast<float>((end_date - start_date).to_int()); break; default: expansion_state = _can_expand() ? ExpansionState::CanExpand : ExpansionState::CannotExpand; } |