Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Public Member Functions | List of all members
cqsp::common::components::ResourceLedger Class Reference

#include <resource.h>

Inheritance diagram for cqsp::common::components::ResourceLedger:
cqsp::common::components::CostTable cqsp::common::components::ResourceConsumption cqsp::common::components::ResourceProduction cqsp::common::components::ResourceStockpile

Public Member Functions

 ResourceLedger ()=default
 
 ~ResourceLedger ()=default
 
double operator[] (const entt::entity) const
 
bool EnoughToTransfer (const ResourceLedger &amount)
 This resource ledger has enough resources inside to transfer "amount" amount of resources away More...
 
void operator-= (const ResourceLedger &)
 
void operator+= (const ResourceLedger &)
 
void operator*= (const ResourceLedger &)
 
void operator/= (const ResourceLedger &)
 
void operator-= (const double value)
 
void operator+= (const double value)
 
void operator*= (const double value)
 
void operator/= (const double value)
 
ResourceLedger operator- (const ResourceLedger &) const
 
ResourceLedger operator+ (const ResourceLedger &) const
 
ResourceLedger operator* (const ResourceLedger &) const
 
ResourceLedger operator/ (const ResourceLedger &) const
 
ResourceLedger operator- (const double value) const
 
ResourceLedger operator+ (const double value) const
 
ResourceLedger operator* (const double value) const
 
ResourceLedger operator/ (const double value) const
 
bool operator< (const ResourceLedger &)
 All resources in this ledger are smaller than than the other ledger More...
 
bool operator> (const ResourceLedger &)
 All resources in this ledger are greater than the other ledger More...
 
bool operator<= (const ResourceLedger &)
 All resources in this ledger are smaller than or equal to than the other ledger More...
 
bool operator>= (const ResourceLedger &)
 All resources in this ledger are greater than or equal to the other ledger More...
 
bool LedgerEquals (const ResourceLedger &)
 
bool operator> (const double &)
 All resources in this ledger are greater than the number More...
 
bool operator< (const double &)
 All resources in this ledger are less than than the number More...
 
bool operator== (const double &)
 
bool operator<= (const double &)
 
bool operator>= (const double &)
 
void AssignFrom (const ResourceLedger &)
 
void TransferTo (ResourceLedger &, const ResourceLedger &)
 
void MultiplyAdd (const ResourceLedger &, double)
 
void RemoveResourcesLimited (const ResourceLedger &)
 Removes the resources, and if the amount of resources removed are more than the resources inside the stockpile, it will set that resource to zero. More...
 
ResourceLedger LimitedRemoveResources (const ResourceLedger &)
 Same as RemoveResourcesLimited, except that it returns how much resources it took out. More...
 
ResourceLedger UnitLeger (const double)
 Returns a copy of the vector with the values set to indicated value More...
 
ResourceLedger Clamp (const double, const double)
 Returns a copy of the vector with the values clamped between the min and max indicated More...
 
ResourceLedger SafeDivision (const ResourceLedger &)
 Returns a copy of the vector divided by the indicated vector, with division by zero resulting in infiniy More...
 
double Average ()
 Returns a copy of the vector divided by the indicated vector, with division by zero resulting in infiniy More...
 
double Min ()
 Finds the smallest value in the Ledger. More...
 
double Max ()
 Finds the largest value in the Ledger. More...
 
bool HasAllResources (const ResourceLedger &)
 Checks if this current resource ledger has any resources in this list More...
 
bool HasGood (entt::entity good)
 
double GetSum ()
 
double MultiplyAndGetSum (ResourceLedger &other)
 Multiplies the numbers stated in the resource ledger. Used for calculating the price, becuase usually the resource ledger will be the price. More...
 
std::string to_string ()
 

Constructor & Destructor Documentation

◆ ResourceLedger()

cqsp::common::components::ResourceLedger::ResourceLedger ( )
default

◆ ~ResourceLedger()

cqsp::common::components::ResourceLedger::~ResourceLedger ( )
default

Member Function Documentation

◆ AssignFrom()

void cqsp::common::components::ResourceLedger::AssignFrom ( const ResourceLedger ledger)

◆ Average()

double cqsp::common::components::ResourceLedger::Average ( )

Returns a copy of the vector divided by the indicated vector, with division by zero resulting in infiniy

◆ Clamp()

ResourceLedger cqsp::common::components::ResourceLedger::Clamp ( const double  minclamp,
const double  maxclamp 
)

Returns a copy of the vector with the values clamped between the min and max indicated

◆ EnoughToTransfer()

bool cqsp::common::components::ResourceLedger::EnoughToTransfer ( const ResourceLedger amount)

This resource ledger has enough resources inside to transfer "amount" amount of resources away

Parameters
amountOther resource ledger
Returns

◆ GetSum()

double cqsp::common::components::ResourceLedger::GetSum ( )

◆ HasAllResources()

bool cqsp::common::components::ResourceLedger::HasAllResources ( const ResourceLedger ledger)

Checks if this current resource ledger has any resources in this list

Returns

◆ HasGood()

bool cqsp::common::components::ResourceLedger::HasGood ( entt::entity  good)
inline

◆ LedgerEquals()

bool cqsp::common::components::ResourceLedger::LedgerEquals ( const ResourceLedger ledger)

◆ LimitedRemoveResources()

ResourceLedger cqsp::common::components::ResourceLedger::LimitedRemoveResources ( const ResourceLedger other)

Same as RemoveResourcesLimited, except that it returns how much resources it took out.

◆ Max()

double cqsp::common::components::ResourceLedger::Max ( )

Finds the largest value in the Ledger.

Returns
The largest value in the ledger

◆ Min()

double cqsp::common::components::ResourceLedger::Min ( )

Finds the smallest value in the Ledger.

Returns
The smallest value in the ledger

◆ MultiplyAdd()

void cqsp::common::components::ResourceLedger::MultiplyAdd ( const ResourceLedger other,
double  value 
)

◆ MultiplyAndGetSum()

double cqsp::common::components::ResourceLedger::MultiplyAndGetSum ( ResourceLedger other)

Multiplies the numbers stated in the resource ledger. Used for calculating the price, becuase usually the resource ledger will be the price.

Returns

◆ operator*() [1/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator* ( const double  value) const

◆ operator*() [2/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator* ( const ResourceLedger other) const

◆ operator*=() [1/2]

void cqsp::common::components::ResourceLedger::operator*= ( const double  value)

◆ operator*=() [2/2]

void cqsp::common::components::ResourceLedger::operator*= ( const ResourceLedger other)

◆ operator+() [1/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator+ ( const double  value) const

◆ operator+() [2/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator+ ( const ResourceLedger other) const

◆ operator+=() [1/2]

void cqsp::common::components::ResourceLedger::operator+= ( const double  value)

◆ operator+=() [2/2]

void cqsp::common::components::ResourceLedger::operator+= ( const ResourceLedger other)

◆ operator-() [1/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator- ( const double  value) const

◆ operator-() [2/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator- ( const ResourceLedger other) const

◆ operator-=() [1/2]

void cqsp::common::components::ResourceLedger::operator-= ( const double  value)

◆ operator-=() [2/2]

void cqsp::common::components::ResourceLedger::operator-= ( const ResourceLedger other)

◆ operator/() [1/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator/ ( const double  value) const

◆ operator/() [2/2]

ResourceLedger cqsp::common::components::ResourceLedger::operator/ ( const ResourceLedger other) const

◆ operator/=() [1/2]

void cqsp::common::components::ResourceLedger::operator/= ( const double  value)

◆ operator/=() [2/2]

void cqsp::common::components::ResourceLedger::operator/= ( const ResourceLedger other)

◆ operator<() [1/2]

bool cqsp::common::components::ResourceLedger::operator< ( const double &  i)

All resources in this ledger are less than than the number

◆ operator<() [2/2]

bool cqsp::common::components::ResourceLedger::operator< ( const ResourceLedger ledger)

All resources in this ledger are smaller than than the other ledger

◆ operator<=() [1/2]

bool cqsp::common::components::ResourceLedger::operator<= ( const double &  i)

◆ operator<=() [2/2]

bool cqsp::common::components::ResourceLedger::operator<= ( const ResourceLedger ledger)

All resources in this ledger are smaller than or equal to than the other ledger

◆ operator==()

bool cqsp::common::components::ResourceLedger::operator== ( const double &  i)

◆ operator>() [1/2]

bool cqsp::common::components::ResourceLedger::operator> ( const double &  i)

All resources in this ledger are greater than the number

◆ operator>() [2/2]

bool cqsp::common::components::ResourceLedger::operator> ( const ResourceLedger ledger)

All resources in this ledger are greater than the other ledger

◆ operator>=() [1/2]

bool cqsp::common::components::ResourceLedger::operator>= ( const double &  i)

◆ operator>=() [2/2]

bool cqsp::common::components::ResourceLedger::operator>= ( const ResourceLedger ledger)

All resources in this ledger are greater than or equal to the other ledger

◆ operator[]()

double cqsp::common::components::ResourceLedger::operator[] ( const entt::entity  entity) const

◆ RemoveResourcesLimited()

void cqsp::common::components::ResourceLedger::RemoveResourcesLimited ( const ResourceLedger other)

Removes the resources, and if the amount of resources removed are more than the resources inside the stockpile, it will set that resource to zero.

◆ SafeDivision()

ResourceLedger cqsp::common::components::ResourceLedger::SafeDivision ( const ResourceLedger other)

Returns a copy of the vector divided by the indicated vector, with division by zero resulting in infiniy

◆ to_string()

std::string cqsp::common::components::ResourceLedger::to_string ( )

◆ TransferTo()

void cqsp::common::components::ResourceLedger::TransferTo ( ResourceLedger ledger_to,
const ResourceLedger amount 
)

◆ UnitLeger()

ResourceLedger cqsp::common::components::ResourceLedger::UnitLeger ( const double  val)

Returns a copy of the vector with the values set to indicated value


The documentation for this class was generated from the following files: