naev
0.10.4
src
commodity.h
1
/*
2
* See Licensing and Copyright notice in naev.h
3
*/
4
#pragma once
5
7
#include <stdint.h>
10
#include "opengl.h"
11
12
#define ECON_CRED_STRLEN 32
13
#define ECON_MASS_STRLEN 32
15
typedef
int64_t credits_t;
16
#define CREDITS_MAX (((credits_t)1) << 53)
17
#define CREDITS_MIN (-CREDITS_MAX)
18
#define CREDITS_PRI PRIu64
19
20
#define COMMODITY_FLAG_STANDARD (1<<0)
21
#define COMMODITY_FLAG_ALWAYS_CAN_SELL (1<<1)
22
#define COMMODITY_FLAG_PRICE_CONSTANT (1<<2)
23
#define commodity_isFlag(c,f) ((c)->flags & (f))
24
#define commodity_setFlag(c,f) ((c)->flags |= (f))
25
#define commodity_rmFlag(c,f) ((c)->flags &= ~(f))
32
typedef
struct
CommodityModifier_ {
33
char
*name;
34
float
value;
35
struct
CommodityModifier_ *next;
36
}
CommodityModifier
;
37
43
typedef
struct
Commodity_ {
44
char
*
name
;
45
char
*
description
;
46
unsigned
int
flags
;
48
/* Prices. */
49
char
*
price_ref
;
50
double
price_mod
;
51
double
raw_price
;
52
double
price
;
53
glTexture
*
gfx_store
;
54
glTexture
*
gfx_space
;
56
/* Misc stuff. */
57
credits_t
lastPurchasePrice
;
58
int
istemp
;
59
int
*
illegalto
;
61
/* Dynamic economy stuff. */
62
CommodityModifier
*
spob_modifier
;
63
double
period
;
64
double
population_modifier
;
65
CommodityModifier
*
faction_modifier
;
66
}
Commodity
;
67
68
typedef
struct
CommodityPrice_ {
69
double
price
;
70
double
spobPeriod
;
71
double
sysPeriod;
72
double
spobVariation
;
73
double
sysVariation
;
74
int64_t
updateTime
;
75
char
*
name
;
76
double
sum
;
77
double
sum2
;
78
int
cnt
;
79
}
CommodityPrice
;
80
81
/*
82
* Commodity stuff.
83
*/
84
Commodity
* commodity_getAll (
void
);
85
Commodity
* commodity_get(
const
char
* name );
86
Commodity
* commodity_getW(
const
char
* name );
87
int
commodity_getN(
void
);
88
89
Commodity
* commodity_getByIndex(
const
int
indx );
90
int
commodity_load (
void
);
91
void
commodity_free (
void
);
92
93
int
commodity_checkIllegal(
const
Commodity
*com,
int
faction );
94
95
/*
96
* Temporary commodities.
97
*/
98
int
commodity_isTemp(
const
char
* name );
99
Commodity
* commodity_newTemp(
const
char
* name,
const
char
* desc );
100
int
commodity_tempIllegalto(
Commodity
*com,
int
faction );
101
102
/*
103
* Misc stuff.
104
*/
105
void
credits2str(
char
*str, credits_t credits,
int
decimals );
106
void
price2str(
char
*str, credits_t price, credits_t credits,
int
decimals );
107
void
tonnes2str(
char
*str,
int
tonnes );
108
int
commodity_compareTech(
const
void
*commodity1,
const
void
*commodity2 );
109
Commodity
** standard_commodities (
void
);
CommodityModifier
Represents a dictionary of values used to modify a commodity.
Definition:
commodity.h:32
CommodityPrice
Definition:
commodity.h:68
CommodityPrice::sum
double sum
Definition:
commodity.h:76
CommodityPrice::price
double price
Definition:
commodity.h:69
CommodityPrice::sysVariation
double sysVariation
Definition:
commodity.h:73
CommodityPrice::name
char * name
Definition:
commodity.h:75
CommodityPrice::cnt
int cnt
Definition:
commodity.h:78
CommodityPrice::sum2
double sum2
Definition:
commodity.h:77
CommodityPrice::spobVariation
double spobVariation
Definition:
commodity.h:72
CommodityPrice::updateTime
int64_t updateTime
Definition:
commodity.h:74
CommodityPrice::spobPeriod
double spobPeriod
Definition:
commodity.h:70
Commodity
Represents a commodity.
Definition:
commodity.h:43
Commodity::description
char * description
Definition:
commodity.h:45
Commodity::spob_modifier
CommodityModifier * spob_modifier
Definition:
commodity.h:62
Commodity::gfx_store
glTexture * gfx_store
Definition:
commodity.h:53
Commodity::illegalto
int * illegalto
Definition:
commodity.h:59
Commodity::population_modifier
double population_modifier
Definition:
commodity.h:64
Commodity::name
char * name
Definition:
commodity.h:44
Commodity::lastPurchasePrice
credits_t lastPurchasePrice
Definition:
commodity.h:57
Commodity::faction_modifier
CommodityModifier * faction_modifier
Definition:
commodity.h:65
Commodity::price_mod
double price_mod
Definition:
commodity.h:50
Commodity::price
double price
Definition:
commodity.h:52
Commodity::gfx_space
glTexture * gfx_space
Definition:
commodity.h:54
Commodity::period
double period
Definition:
commodity.h:63
Commodity::raw_price
double raw_price
Definition:
commodity.h:51
Commodity::istemp
int istemp
Definition:
commodity.h:58
Commodity::price_ref
char * price_ref
Definition:
commodity.h:49
Commodity::flags
unsigned int flags
Definition:
commodity.h:46
glTexture
Abstraction for rendering sprite sheets.
Definition:
opengl_tex.h:34
Generated by
1.9.3