diff options
author | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
commit | c0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (patch) | |
tree | ebc9c03b5bd0a6b11068ac37aca302f6ceb24a18 /src/openvic-simulation/economy/GoodInstance.cpp | |
parent | 1198a780916e65cae048dd3478f614c1d18db846 (diff) |
Add GoodInstancegood-instance
Diffstat (limited to 'src/openvic-simulation/economy/GoodInstance.cpp')
-rw-r--r-- | src/openvic-simulation/economy/GoodInstance.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/openvic-simulation/economy/GoodInstance.cpp b/src/openvic-simulation/economy/GoodInstance.cpp new file mode 100644 index 0000000..937706d --- /dev/null +++ b/src/openvic-simulation/economy/GoodInstance.cpp @@ -0,0 +1,20 @@ +#include "GoodInstance.hpp" + +using namespace OpenVic; + +GoodInstance::GoodInstance(GoodDefinition const& new_good_definition) + : HasIdentifierAndColour { new_good_definition }, good_definition { new_good_definition }, + price { new_good_definition.get_base_price() }, available { new_good_definition.is_available_from_start() } {} + +bool GoodInstanceManager::setup_good_instances(GoodDefinitionManager const& good_definition_manager) { + good_instances.reset(); + good_instances.reserve(good_definition_manager.get_good_definition_count()); + + bool ret = true; + + for (GoodDefinition const& good : good_definition_manager.get_good_definitions()) { + ret &= good_instances.add_item({ good }); + } + + return ret; +} |