diff options
author | Hop311 <Hop3114@gmail.com> | 2024-09-07 23:21:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-07 23:21:16 +0200 |
commit | e97eef1fdd7525e4f33c9864f207a3e3d711c3c5 (patch) | |
tree | def5b7b88af8247689c6c97293d7527988f69001 /src | |
parent | d36045735fc56e8cfe772713c2ef5012dad94ae3 (diff) | |
parent | 0526fc01707c879aad2d4e96293701ae12068304 (diff) |
Merge pull request #193 from OpenVicProject/remove-price_t
Remove price_t alias
Diffstat (limited to 'src')
-rw-r--r-- | src/openvic-simulation/economy/GoodDefinition.cpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/economy/GoodDefinition.hpp | 9 | ||||
-rw-r--r-- | src/openvic-simulation/economy/GoodInstance.hpp | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/openvic-simulation/economy/GoodDefinition.cpp b/src/openvic-simulation/economy/GoodDefinition.cpp index 892592d..f21ea18 100644 --- a/src/openvic-simulation/economy/GoodDefinition.cpp +++ b/src/openvic-simulation/economy/GoodDefinition.cpp @@ -10,7 +10,7 @@ GoodDefinition::GoodDefinition( colour_t new_colour, index_t new_index, GoodCategory const& new_category, - price_t new_base_price, + fixed_point_t new_base_price, bool new_available_from_start, bool new_tradeable, bool new_money, @@ -33,14 +33,14 @@ bool GoodDefinitionManager::add_good_category(std::string_view identifier) { } bool GoodDefinitionManager::add_good_definition( - std::string_view identifier, colour_t colour, GoodCategory const& category, GoodDefinition::price_t base_price, + std::string_view identifier, colour_t colour, GoodCategory const& category, fixed_point_t base_price, bool available_from_start, bool tradeable, bool money, bool overseas_penalty ) { if (identifier.empty()) { Logger::error("Invalid good identifier - empty!"); return false; } - if (base_price <= GoodDefinition::NULL_PRICE) { + if (base_price <= 0) { Logger::error("Invalid base price for ", identifier, ": ", base_price); return false; } @@ -65,7 +65,7 @@ bool GoodDefinitionManager::load_goods_file(ast::NodeCPtr root) { ret &= expect_good_category_dictionary([this](GoodCategory const& good_category, ast::NodeCPtr good_category_value) -> bool { return expect_dictionary([this, &good_category](std::string_view key, ast::NodeCPtr value) -> bool { colour_t colour = colour_t::null(); - GoodDefinition::price_t base_price; + fixed_point_t base_price; bool available_from_start = true, tradeable = true; bool money = false, overseas_penalty = false; diff --git a/src/openvic-simulation/economy/GoodDefinition.hpp b/src/openvic-simulation/economy/GoodDefinition.hpp index 3050243..15eb4e8 100644 --- a/src/openvic-simulation/economy/GoodDefinition.hpp +++ b/src/openvic-simulation/economy/GoodDefinition.hpp @@ -31,14 +31,11 @@ namespace OpenVic { struct GoodDefinition : HasIdentifierAndColour, HasIndex<> { friend struct GoodDefinitionManager; - using price_t = fixed_point_t; - static constexpr price_t NULL_PRICE = fixed_point_t::_0(); - using good_definition_map_t = fixed_point_map_t<GoodDefinition const*>; private: GoodCategory const& PROPERTY(category); - const price_t PROPERTY(base_price); + const fixed_point_t PROPERTY(base_price); const bool PROPERTY_CUSTOM_PREFIX(available_from_start, is); const bool PROPERTY_CUSTOM_PREFIX(tradeable, is); const bool PROPERTY(money); @@ -46,7 +43,7 @@ namespace OpenVic { GoodDefinition( std::string_view new_identifier, colour_t new_colour, index_t new_index, GoodCategory const& new_category, - price_t new_base_price, bool new_available_from_start, bool new_tradeable, bool new_money, + fixed_point_t new_base_price, bool new_available_from_start, bool new_tradeable, bool new_money, bool new_overseas_penalty ); @@ -63,7 +60,7 @@ namespace OpenVic { bool add_good_category(std::string_view identifier); bool add_good_definition( - std::string_view identifier, colour_t colour, GoodCategory const& category, GoodDefinition::price_t base_price, + std::string_view identifier, colour_t colour, GoodCategory const& category, fixed_point_t base_price, bool available_from_start, bool tradeable, bool money, bool overseas_penalty ); diff --git a/src/openvic-simulation/economy/GoodInstance.hpp b/src/openvic-simulation/economy/GoodInstance.hpp index 555ef87..20370ef 100644 --- a/src/openvic-simulation/economy/GoodInstance.hpp +++ b/src/openvic-simulation/economy/GoodInstance.hpp @@ -13,7 +13,7 @@ namespace OpenVic { private: GoodDefinition const& PROPERTY(good_definition); - GoodDefinition::price_t PROPERTY(price); + fixed_point_t PROPERTY(price); bool PROPERTY(available); // TODO - supply, demand, actual bought |