aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openvic-simulation/economy/GoodDefinition.cpp8
-rw-r--r--src/openvic-simulation/economy/GoodDefinition.hpp9
-rw-r--r--src/openvic-simulation/economy/GoodInstance.hpp2
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