From 02291628489c8c6fb75aa6886e18794e67bedc34 Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:20:28 +0100 Subject: artisan_goods_ modifiers have no effect --- src/openvic-simulation/economy/GoodDefinition.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/openvic-simulation') diff --git a/src/openvic-simulation/economy/GoodDefinition.cpp b/src/openvic-simulation/economy/GoodDefinition.cpp index ba5aff8..5440b94 100644 --- a/src/openvic-simulation/economy/GoodDefinition.cpp +++ b/src/openvic-simulation/economy/GoodDefinition.cpp @@ -90,6 +90,7 @@ bool GoodDefinitionManager::load_goods_file(ast::NodeCPtr root) { } bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager) const { + constexpr bool has_no_effect = true; using enum ModifierEffect::format_t; using enum ModifierEffect::target_t; @@ -116,11 +117,11 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager const auto good_modifier = [&modifier_manager, &ret, &good_identifier]( ModifierEffect const*& effect_cache, std::string_view name, bool is_positive_good, - std::string_view localisation_key + std::string_view localisation_key, bool has_no_effect = false ) -> void { ret &= modifier_manager.register_technology_modifier_effect( effect_cache, ModifierManager::get_flat_identifier(name, good_identifier), is_positive_good, - PROPORTION_DECIMAL, localisation_key + PROPORTION_DECIMAL, localisation_key, has_no_effect ); }; @@ -132,15 +133,15 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager good_modifier( this_good_effects.artisan_goods_input, "artisan_goods_input", false, - make_production_localisation_suffix("TECH_INPUT") + make_production_localisation_suffix("TECH_INPUT"), has_no_effect ); good_modifier( this_good_effects.artisan_goods_output, "artisan_goods_output", true, - make_production_localisation_suffix("TECH_OUTPUT") + make_production_localisation_suffix("TECH_OUTPUT"), has_no_effect ); good_modifier( this_good_effects.artisan_goods_throughput, "artisan_goods_throughput", true, - make_production_localisation_suffix("TECH_THROUGHPUT") + make_production_localisation_suffix("TECH_THROUGHPUT"), has_no_effect ); good_modifier( this_good_effects.factory_goods_input, "factory_goods_input", false, -- cgit v1.2.3-56-ga3b1 From 802ee0a9566e98f2958ebd295072fe9caa8a71b5 Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Sun, 3 Nov 2024 11:26:05 +0100 Subject: Remove unused (and inaccurate) fixed point members --- .../types/fixed_point/FixedPoint.hpp | 100 ++------------------- 1 file changed, 6 insertions(+), 94 deletions(-) (limited to 'src/openvic-simulation') diff --git a/src/openvic-simulation/types/fixed_point/FixedPoint.hpp b/src/openvic-simulation/types/fixed_point/FixedPoint.hpp index 7752226..bc74d1c 100644 --- a/src/openvic-simulation/types/fixed_point/FixedPoint.hpp +++ b/src/openvic-simulation/types/fixed_point/FixedPoint.hpp @@ -38,6 +38,11 @@ namespace OpenVic { #include "openvic-simulation/types/fixed_point/FixedPointLUT_sin.hpp" static_assert(SIN_LUT_PRECISION == PRECISION); + + // Doesn't account for sign, so -n.abc -> 1 - 0.abc + constexpr fixed_point_t get_frac() const { + return value & FRAC_MASK; + } public: constexpr fixed_point_t() : value { 0 } {} @@ -74,110 +79,22 @@ namespace OpenVic { return 2; } - static constexpr fixed_point_t _3() { - return 3; - } - static constexpr fixed_point_t _4() { return 4; } - static constexpr fixed_point_t _5() { - return 5; - } - - static constexpr fixed_point_t _6() { - return 6; - } - - static constexpr fixed_point_t _7() { - return 7; - } - - static constexpr fixed_point_t _8() { - return 8; - } - - static constexpr fixed_point_t _9() { - return 9; - } - - static constexpr fixed_point_t _10() { - return 10; - } - - static constexpr fixed_point_t _50() { - return 50; - } - static constexpr fixed_point_t _100() { return 100; } - static constexpr fixed_point_t _200() { - return 200; - } - - static constexpr fixed_point_t _0_01() { - return _1() / _100(); - } - - static constexpr fixed_point_t _0_02() { - return _0_01() * 2; - } - - static constexpr fixed_point_t _0_03() { - return _0_01() * 3; - } - - static constexpr fixed_point_t _0_04() { - return _0_01() * 4; - } - - static constexpr fixed_point_t _0_05() { - return _0_01() * 5; - } - - static constexpr fixed_point_t _0_10() { - return _1() / 10; - } - static constexpr fixed_point_t _0_20() { - return _0_10() * 2; - } - - static constexpr fixed_point_t _0_25() { - return _1() / 4; - } - - static constexpr fixed_point_t _0_33() { - return _1() / 3; + return _1() / 5; } static constexpr fixed_point_t _0_50() { return _1() / 2; } - static constexpr fixed_point_t _0_75() { - return _1() - _0_25(); - } - - static constexpr fixed_point_t _0_95() { - return _1() - _0_05(); - } - - static constexpr fixed_point_t _0_99() { - return _1() - _0_01(); - } - - static constexpr fixed_point_t _1_01() { - return _1() + _0_01(); - } - - static constexpr fixed_point_t _1_10() { - return _1() + _0_10(); - } - static constexpr fixed_point_t _1_50() { return _1() + _0_50(); } @@ -253,11 +170,6 @@ namespace OpenVic { : 0; } - // Doesn't account for sign, so -n.abc -> 1 - 0.abc - constexpr fixed_point_t get_frac() const { - return value & FRAC_MASK; - } - constexpr bool is_integer() const { return get_frac() == 0; } -- cgit v1.2.3-56-ga3b1