10#include "opengl_tex.h"
12#define ECON_CRED_STRLEN \
14#define ECON_MASS_STRLEN \
17typedef int64_t credits_t;
24#define CREDITS_PRI PRIu64
26#define COMMODITY_FLAG_STANDARD \
29#define COMMODITY_FLAG_ALWAYS_CAN_SELL \
32#define COMMODITY_FLAG_PRICE_CONSTANT \
34#define commodity_isFlag( c, f ) \
35 ( ( c )->flags & ( f ) )
36#define commodity_setFlag( c, f ) \
37 ( ( c )->flags |= ( f ) )
38#define commodity_rmFlag( c, f ) \
39 ( ( c )->flags &= ~( f ) )
46typedef struct CommodityModifier_ {
49 struct CommodityModifier_ *next;
57typedef struct Commodity_ {
87typedef struct CommodityPrice_ {
133void credits2str(
char *str, credits_t credits,
int decimals );
134void price2str(
char *str, credits_t price, credits_t credits,
int decimals );
Commodity * commodity_getAll(void)
Gets all the commodities.
Commodity * commodity_get(const char *name)
Gets a commodity by name.
Commodity * commodity_newTemp(const char *name, const char *desc)
Creates a new temporary commodity.
void commodity_free(void)
Frees all the loaded commodities.
Commodity * commodity_getByIndex(const int indx)
Gets a commodity by index.
void credits2str(char *str, credits_t credits, int decimals)
Converts credits to a usable string for displaying.
void tonnes2str(char *str, int tonnes)
Converts tonnes to a usable string for displaying.
int commodity_getN(void)
Return the number of commodities globally.
int commodity_compareTech(const void *commodity1, const void *commodity2)
Function meant for use with C89, C99 algorithm qsort().
void price2str(char *str, credits_t price, credits_t credits, int decimals)
Given a price and on-hand credits, outputs a colourized string.
int commodity_load(void)
Loads all the commodity data.
Commodity ** standard_commodities(void)
Return an array (array.h) of standard commodities. Free with array_free. (Don't free contents....
int commodity_checkIllegal(const Commodity *com, int faction)
Checks to see if a commodity is illegal to a faction.
Commodity * commodity_getW(const char *name)
Gets a commodity by name without warning.
int commodity_tempIllegalto(Commodity *com, int faction)
Makes a temporary commodity illegal to something.
int commodity_isTemp(const char *name)
Checks to see if a commodity is temporary.
Represents a dictionary of values used to modify a commodity.
CommodityModifier * spob_modifier
double population_modifier
credits_t lastPurchasePrice
CommodityModifier * faction_modifier
Abstraction for rendering sprite sheets.