diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-11-04 13:17:55 +0100 |
---|---|---|
committer | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-11-04 14:38:19 +0100 |
commit | c12e742ca980d7213e2bc08b902b63117aea54f6 (patch) | |
tree | d128c5f6abe32904b9a5a2a03718ace64c85c2e2 /src/openvic-simulation/economy/GoodInstance.cpp | |
parent | 89e9c05f4d6276efa82fe486156357f841f864c3 (diff) |
Implement artisanal productionartisanal_production
Diffstat (limited to 'src/openvic-simulation/economy/GoodInstance.cpp')
-rw-r--r-- | src/openvic-simulation/economy/GoodInstance.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/openvic-simulation/economy/GoodInstance.cpp b/src/openvic-simulation/economy/GoodInstance.cpp index 3e3d88e..e48624c 100644 --- a/src/openvic-simulation/economy/GoodInstance.cpp +++ b/src/openvic-simulation/economy/GoodInstance.cpp @@ -13,6 +13,17 @@ GoodInstance::GoodInstance(GoodDefinition const& new_good_definition) market_sell_order_callbacks {} {} +void GoodInstance::add_buy_up_to_order( + const fixed_point_t max_quantity, + const fixed_point_t money_to_spend, + const std::function<void(const BuyResult)> callback +) { + demand_running_total += max_quantity; + buy_up_to_order_max_quantities.push_back(max_quantity); + buy_up_to_order_money_to_spend.push_back(money_to_spend); + buy_up_to_order_callbacks.push_back(callback); +} + void GoodInstance::add_market_sell_order(const fixed_point_t quantity, const std::function<void(SellResult)> callback) { supply_running_total += quantity; market_sell_order_quantities.push_back(quantity); @@ -20,8 +31,13 @@ void GoodInstance::add_market_sell_order(const fixed_point_t quantity, const std } void GoodInstance::clear_orders() { + total_demand_yesterday = demand_running_total; + demand_running_total = fixed_point_t::_0(); total_supply_yesterday = supply_running_total; supply_running_total = fixed_point_t::_0(); + + buy_up_to_order_max_quantities.clear(); + buy_up_to_order_callbacks.clear(); market_sell_order_quantities.clear(); market_sell_order_callbacks.clear(); } |