13#ifndef FC__TRADEROUTES_H
14#define FC__TRADEROUTES_H
52#define SPECENUM_NAME trade_route_bonus_type
53#define SPECENUM_VALUE0 TBONUS_NONE
54#define SPECENUM_VALUE0NAME "None"
55#define SPECENUM_VALUE1 TBONUS_GOLD
56#define SPECENUM_VALUE1NAME "Gold"
57#define SPECENUM_VALUE2 TBONUS_SCIENCE
58#define SPECENUM_VALUE2NAME "Science"
59#define SPECENUM_VALUE3 TBONUS_BOTH
60#define SPECENUM_VALUE3NAME "Both"
64#define SPECENUM_NAME route_direction
65#define SPECENUM_VALUE0 RDIR_NONE
66#define SPECENUM_VALUE0NAME N_("?routedir:None")
67#define SPECENUM_VALUE1 RDIR_FROM
68#define SPECENUM_VALUE1NAME N_("?routedir:From")
69#define SPECENUM_VALUE2 RDIR_TO
70#define SPECENUM_VALUE2NAME N_("?routedir:To")
71#define SPECENUM_VALUE3 RDIR_BIDIRECTIONAL
72#define SPECENUM_VALUE3NAME N_("?routedir:Bidirectional")
91#define SPECLIST_TAG trade_route
92#define SPECLIST_TYPE struct trade_route
95#define trade_route_list_iterate(trade_route_list, proute) \
96 TYPED_LIST_ITERATE(struct trade_route, trade_route_list, proute)
97#define trade_route_list_iterate_end LIST_ITERATE_END
130#define trade_routes_iterate(c, proute) \
132 trade_route_list_iterate(c->routes, proute) {
134#define trade_routes_iterate_end \
135 } trade_route_list_iterate_end; \
138#define trade_routes_iterate_safe(c, proute) \
140 struct city *c##_proute = c; \
141 int _routes##_size = trade_route_list_size(c##_proute->routes); \
143 if (_routes##_size > 0) { \
144 struct trade_route *_routes##_saved[_routes##_size]; \
145 int _routes##_index; \
147 _routes##_size = 0; \
148 trade_routes_iterate(c##_proute, _proute) { \
149 _routes##_saved[_routes##_size++] = _proute; \
150 } trade_routes_iterate_end; \
151 for (_routes##_index = 0; \
152 _routes##_index < _routes##_size; \
153 _routes##_index++) { \
154 struct trade_route *proute = _routes##_saved[_routes##_index];
156#define trade_routes_iterate_safe_end \
161#define trade_partners_iterate(c, p) \
163 trade_routes_iterate(c, _proute_) { \
164 struct city *p = game_city_by_number(_proute_->partner);
166#define trade_partners_iterate_end \
167 } trade_routes_iterate_end; \
171#define SPECENUM_NAME goods_flag_id
172#define SPECENUM_VALUE0 GF_BIDIRECTIONAL
173#define SPECENUM_VALUE0NAME "Bidirectional"
174#define SPECENUM_VALUE1 GF_DEPLETES
175#define SPECENUM_VALUE1NAME "Depletes"
176#define SPECENUM_VALUE2 GF_SELF_PROVIDED
177#define SPECENUM_VALUE2NAME "Self-Provided"
178#define SPECENUM_COUNT GF_COUNT
179#define SPECENUM_BITVECTOR bv_goods_flags
221#define goods_type_iterate(_p) \
224 for (_i_ = 0; _i_ < game.control.num_goods_types ; _i_++) { \
225 struct goods_type *_p = goods_by_number(_i_);
227#define goods_type_iterate_end \
231#define goods_type_re_active_iterate(_p) \
232 goods_type_iterate(_p) { \
233 if (!_p->ruledit_disabled) {
235#define goods_type_re_active_iterate_end \
237 } goods_type_iterate_end;
static void base(QVariant data1, QVariant data2)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct requirement_vector reqs
struct name_translation name
enum trade_route_bonus_type bonus_type
enum trade_route_illegal_cancelling cancelling
struct goods_type * goods
int max_trade_prod(const struct city *pcity)
struct goods_type * goods_from_city_to_unit(struct city *src, struct unit *punit)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
enum trade_route_type cities_trade_route_type(const struct city *pcity1, const struct city *pcity2)
int trade_route_type_trade_pct(enum trade_route_type type)
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
int city_num_trade_routes(const struct city *pcity)
Goods_type_id goods_number(const struct goods_type *pgood)
bool goods_has_flag(const struct goods_type *pgood, enum goods_flag_id flag)
enum trade_route_illegal_cancelling trade_route_cancelling_type_by_name(const char *name)
const char * trade_route_type_name(enum trade_route_type type)
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
trade_route_illegal_cancelling
struct goods_type * goods_by_rule_name(const char *name)
int trade_from_route(const struct city *pc1, const struct trade_route *route, int base)
const char * goods_rule_name(struct goods_type *pgood)
unsigned max_trade_routes(const struct city *pcity)
const char * goods_name_translation(struct goods_type *pgood)
void trade_route_types_init(void)
Goods_type_id goods_index(const struct goods_type *pgood)
struct goods_type * goods_by_translated_name(const char *name)
int city_trade_removable(const struct city *pcity, struct trade_route_list *would_remove)
bool can_establish_trade_route(const struct city *pc1, const struct city *pc2)
struct goods_type * goods_by_number(Goods_type_id id)
const char * trade_route_cancelling_type_name(enum trade_route_illegal_cancelling type)
bool goods_can_be_provided(const struct city *pcity, const struct goods_type *pgood, struct unit *punit)
bool city_receives_goods(const struct city *pcity, const struct goods_type *pgood)
enum trade_route_type trade_route_type_by_name(const char *name)
bool have_cities_trade_route(const struct city *pc1, const struct city *pc2)
int get_caravan_enter_city_trade_bonus(const struct city *pc1, const struct city *pc2, const struct unit_type *ut, struct goods_type *pgood, const bool establish_trade)