|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <cstddef> |
| 4 | +#include <cstdint> |
| 5 | + |
| 6 | +#include "openvic-simulation/economy/Good.hpp" |
| 7 | +#include "openvic-simulation/economy/ProductionType.hpp" |
| 8 | +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" |
| 9 | +#include "openvic-simulation/utility/Getters.hpp" |
| 10 | + |
| 11 | +namespace OpenVic { |
| 12 | + class Producer { |
| 13 | + public: |
| 14 | + ProductionType const& PROPERTY(production_type); |
| 15 | + }; |
| 16 | + |
| 17 | + class Manufacturer : public virtual Producer { |
| 18 | + public: |
| 19 | + Good::good_map_t PROPERTY(stockpile); |
| 20 | + }; |
| 21 | + |
| 22 | + class ArtisanalProducer final : public Manufacturer { |
| 23 | + public: |
| 24 | + fixed_point_t PROPERTY(current_production); |
| 25 | + Good::good_map_t PROPERTY(current_needs); |
| 26 | + }; |
| 27 | + |
| 28 | + class NonArtisanalProducer : public virtual Producer { |
| 29 | + public: |
| 30 | + fixed_point_t PROPERTY(revenue_yesterday); |
| 31 | + fixed_point_t PROPERTY(output_quantity_yesterday); |
| 32 | + fixed_point_t PROPERTY(unsold_quantity_yesterday); |
| 33 | + fixed_point_t PROPERTY(size_multiplier); |
| 34 | + ordered_map<Pop const*, Pop::pop_size_t> PROPERTY(employees); |
| 35 | + }; |
| 36 | + |
| 37 | + class FactoryProducer final : public NonArtisanalProducer, public Manufacturer { |
| 38 | + private: |
| 39 | + static constexpr size_t days_of_history = 7; |
| 40 | + int PROPERTY(profit_history_current); |
| 41 | + std::array<fixed_point_t, days_of_history> PROPERTY(daily_profit_history); |
| 42 | + |
| 43 | + public: |
| 44 | + fixed_point_t PROPERTY(budget); |
| 45 | + fixed_point_t PROPERTY(balance_yesterday); |
| 46 | + fixed_point_t PROPERTY(received_investments_yesterday); |
| 47 | + fixed_point_t PROPERTY(market_spendings_yesterday); |
| 48 | + fixed_point_t PROPERTY(paychecks_yesterday); |
| 49 | + uint32_t PROPERTY(unprofitable_days); |
| 50 | + uint32_t PROPERTY(injected_days); |
| 51 | + uint32_t PROPERTY(days_without_input); |
| 52 | + uint8_t PROPERTY_RW_ACCESS(hiring_priority, public); |
| 53 | + |
| 54 | + fixed_point_t get_profitability_yesterday() const { |
| 55 | + return daily_profit_history[profit_history_current]; |
| 56 | + } |
| 57 | + |
| 58 | + fixed_point_t get_average_profitability_last_seven_days() const { |
| 59 | + fixed_point_t sum = 0; |
| 60 | + |
| 61 | + for (int i = 0; i <= profit_history_current; i++) { |
| 62 | + sum += daily_profit_history[i]; |
| 63 | + } |
| 64 | + |
| 65 | + return sum / (1 + profit_history_current); |
| 66 | + } |
| 67 | + }; |
| 68 | + |
| 69 | + class ResourceGatheringOpertion final : public NonArtisanalProducer { |
| 70 | + public: |
| 71 | + ResourceGatheringOpertion(ProductionType const& production_type, fixed_point_t size_multiplier); |
| 72 | + }; |
| 73 | +} |
0 commit comments