Symphony Of Empires
Product Struct Reference

A product (based off a Commodity) which can be bought by POPs, converted by factories and transported. More...

#include <product.hpp>

Inheritance diagram for Product:
Collaboration diagram for Product:

Public Member Functions

float get_price_delta () const
 
float sd_ratio () const
 
float ds_ratio () const
 
void close_market ()
 
float buy (float amount)
 Buy a portion of the item. More...
 
float produce (float amount)
 Produce the product. More...
 
- Public Member Functions inherited from Entity< ProductId >
constexpr Entity () noexcept=default
 
constexpr Entity (Entity &&) noexcept=default
 
constexpr Entity (const Entity &) noexcept=default
 
constexpr Entityoperator= (const Entity &) noexcept=default
 
constexpr ~Entity () noexcept=default
 
constexpr bool is_invalid () const
 Checks if the current id is invalid. More...
 
constexpr bool is_valid () const
 Checks if the current id is valid. More...
 
constexpr operator Id () const noexcept
 
constexpr operator size_t () const noexcept
 
constexpr Id get_id () const
 

Public Attributes

float price = 1.f
 
float price_delta = 0.f
 
float bought = 0.f
 
float produced = 0.f
 
float supply = 1.f
 
float demand = 1.f
 
float global_demand = 1.f
 
float speculative_demand = 0.f
 
- Public Attributes inherited from Entity< ProductId >
Id cached_id
 Id used to speed up Id lookups on any context. More...
 

Additional Inherited Members

- Public Types inherited from Entity< ProductId >
using Id = ProductId
 
- Static Public Member Functions inherited from Entity< ProductId >
constexpr static Id invalid ()
 Returns an invalid id. More...
 
constexpr static bool is_invalid (Id id)
 Checks if the id is not valid. More...
 
constexpr static bool is_valid (Id id)
 Checks if the id is valid. More...
 

Detailed Description

A product (based off a Commodity) which can be bought by POPs, converted by factories and transported.

Definition at line 54 of file product.hpp.

Member Function Documentation

◆ buy()

float Product::buy ( float  amount)
inline

Buy a portion of the item.

Parameters
amountAmount to buy
Returns
float Total cost of purchase

Definition at line 97 of file product.hpp.

◆ close_market()

void Product::close_market ( )
inline

Definition at line 80 of file product.hpp.

Here is the call graph for this function:

◆ ds_ratio()

float Product::ds_ratio ( ) const
inline

Definition at line 74 of file product.hpp.

◆ get_price_delta()

float Product::get_price_delta ( ) const
inline

Definition at line 55 of file product.hpp.

Here is the caller graph for this function:

◆ produce()

float Product::produce ( float  amount)
inline

Produce the product.

Parameters
amountAmount to produce
Returns
float Total gains from production

Definition at line 108 of file product.hpp.

◆ sd_ratio()

float Product::sd_ratio ( ) const
inline

Definition at line 68 of file product.hpp.

Member Data Documentation

◆ bought

float Product::bought = 0.f

Definition at line 116 of file product.hpp.

◆ demand

float Product::demand = 1.f

Definition at line 119 of file product.hpp.

◆ global_demand

float Product::global_demand = 1.f

Definition at line 120 of file product.hpp.

◆ price

float Product::price = 1.f

Definition at line 114 of file product.hpp.

◆ price_delta

float Product::price_delta = 0.f

Definition at line 115 of file product.hpp.

◆ produced

float Product::produced = 0.f

Definition at line 117 of file product.hpp.

◆ speculative_demand

float Product::speculative_demand = 0.f

Definition at line 121 of file product.hpp.

◆ supply

float Product::supply = 1.f

Definition at line 118 of file product.hpp.


The documentation for this struct was generated from the following file: