File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ void BuildingInstance::update_gamestate(Date today) {
3232 end_date = start_date + building_type.get_build_time ();
3333 break ;
3434 case ExpansionState::Expanding:
35- expansion_progress = fixed_point_t { static_cast <int32_t >((today - start_date).to_int ()) } / (end_date - start_date).to_int ();
35+ expansion_progress = fixed_point_t { static_cast <int32_t >((today - start_date).to_int ()) }
36+ / static_cast <int32_t >((end_date - start_date).to_int ());
3637 break ;
3738 default : expansion_state = _can_expand () ? ExpansionState::CanExpand : ExpansionState::CannotExpand;
3839 }
Original file line number Diff line number Diff line change 11#pragma once
22
33#include < cassert>
4- #include < cctype>
54#include < charconv>
65#include < concepts>
76#include < cstddef>
@@ -78,7 +77,8 @@ namespace OpenVic {
7877
7978 public:
8079 OV_ALWAYS_INLINE constexpr fixed_point_t () : value { 0 } {}
81- OV_ALWAYS_INLINE constexpr fixed_point_t (int32_t new_value) : value { static_cast <value_type>(new_value) << PRECISION } {}
80+ template <integral_max_size_4 T>
81+ OV_ALWAYS_INLINE constexpr fixed_point_t (T new_value) : value { static_cast <value_type>(new_value) << PRECISION } {}
8282
8383 static const fixed_point_t max;
8484 static const fixed_point_t min;
@@ -238,7 +238,7 @@ namespace OpenVic {
238238 return truncate ();
239239 }
240240
241- return floor<value_type>();
241+ return parse_raw ( floor<value_type>() );
242242 }
243243
244244 template <std::integral T>
@@ -255,7 +255,7 @@ namespace OpenVic {
255255 return truncate ();
256256 }
257257
258- return ceil<value_type>();
258+ return parse_raw ( ceil<value_type>() );
259259 }
260260
261261 OV_SPEED_INLINE constexpr fixed_point_t round () const {
You can’t perform that action at this time.
0 commit comments