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
131#define trade_routes_iterate(c, proute) \
133 trade_route_list_iterate(c->routes, proute) {
135#define trade_routes_iterate_end \
136 } trade_route_list_iterate_end; \
139#define trade_routes_iterate_safe(c, proute) \
141 struct city *c##_proute = c; \
142 int _routes##_size = trade_route_list_size(c##_proute->routes); \
144 if (_routes##_size > 0) { \
145 struct trade_route *_routes##_saved[_routes##_size]; \
146 int _routes##_index; \
148 _routes##_size = 0; \
149 trade_routes_iterate(c##_proute, _proute) { \
150 _routes##_saved[_routes##_size++] = _proute; \
151 } trade_routes_iterate_end; \
152 for (_routes##_index = 0; \
153 _routes##_index < _routes##_size; \
154 _routes##_index++) { \
155 struct trade_route *proute = _routes##_saved[_routes##_index];
157#define trade_routes_iterate_safe_end \
162#define trade_partners_iterate(c, p) \
164 trade_routes_iterate(c, _proute_) { \
165 struct city *p = game_city_by_number(_proute_->partner);
167#define trade_partners_iterate_end \
168 } trade_routes_iterate_end; \
172#define SPECENUM_NAME goods_flag_id
173#define SPECENUM_VALUE0 GF_BIDIRECTIONAL
174#define SPECENUM_VALUE0NAME "Bidirectional"
175#define SPECENUM_VALUE1 GF_DEPLETES
176#define SPECENUM_VALUE1NAME "Depletes"
177#define SPECENUM_VALUE2 GF_SELF_PROVIDED
178#define SPECENUM_VALUE2NAME "Self-Provided"
179#define SPECENUM_COUNT GF_COUNT
180#define SPECENUM_BITVECTOR bv_goods_flags
184#define GOODS_HIGH_PRIORITY 100
227 const struct city *homecity);
231#define goods_type_iterate(_p) \
234 for (_i_ = 0; _i_ < game.control.num_goods_types ; _i_++) { \
235 struct goods_type *_p = goods_by_number(_i_);
237#define goods_type_iterate_end \
241#define goods_type_re_active_iterate(_p) \
242 goods_type_iterate(_p) { \
243 if (!_p->ruledit_disabled) {
245#define goods_type_re_active_iterate_end \
247 } 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 unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
SPECPQ_PRIORITY_TYPE priority
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)
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)
bool goods_can_be_provided(const struct city *pcity, const struct goods_type *pgood, const struct unit *punit)
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)
struct goods_type * goods_from_city_to_unit(const struct city *src, const struct unit *punit)
struct goods_type * unit_current_goods(const struct unit *punit, const struct city *homecity)
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, int priority, struct trade_route_list *would_remove)
bool can_establish_trade_route(const struct city *pc1, const struct city *pc2, int priority)
struct goods_type * goods_by_number(Goods_type_id id)
const char * trade_route_cancelling_type_name(enum trade_route_illegal_cancelling type)
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)