44 #define SPECENUM_NAME traderoute_bonus_type
45 #define SPECENUM_VALUE0 TBONUS_NONE
46 #define SPECENUM_VALUE0NAME "None"
47 #define SPECENUM_VALUE1 TBONUS_GOLD
48 #define SPECENUM_VALUE1NAME "Gold"
49 #define SPECENUM_VALUE2 TBONUS_SCIENCE
50 #define SPECENUM_VALUE2NAME "Science"
51 #define SPECENUM_VALUE3 TBONUS_BOTH
52 #define SPECENUM_VALUE3NAME "Both"
53 #include "specenum_gen.h"
55 #define SPECENUM_NAME route_direction
56 #define SPECENUM_VALUE0 RDIR_FROM
57 #define SPECENUM_VALUE0NAME N_("?routedir:From")
58 #define SPECENUM_VALUE1 RDIR_TO
59 #define SPECENUM_VALUE1NAME N_("?routedir:To")
60 #define SPECENUM_VALUE2 RDIR_BIDIRECTIONAL
61 #define SPECENUM_VALUE2NAME N_("?routedir:Bidirectional")
62 #include "specenum_gen.h"
75 enum route_direction
dir;
80 #define SPECLIST_TAG trade_route
81 #define SPECLIST_TYPE struct trade_route
84 #define trade_route_list_iterate(trade_route_list, proute) \
85 TYPED_LIST_ITERATE(struct trade_route, trade_route_list, proute)
86 #define trade_route_list_iterate_end LIST_ITERATE_END
90 const struct city *pcity2);
107 const struct city *pc2);
110 const struct city *pc2);
115 const struct city *pc2,
118 const bool establish_trade);
120 struct trade_route_list *would_remove);
122 #define trade_routes_iterate(c, proute) \
124 trade_route_list_iterate(c->routes, proute) \
127 #define trade_routes_iterate_end \
129 trade_route_list_iterate_end; \
133 #define trade_routes_iterate_safe(c, proute) \
135 int _routes##_size = trade_route_list_size(c->routes); \
136 if (_routes##_size > 0) { \
137 struct trade_route *_routes##_saved[_routes##_size]; \
138 int _routes##_index = 0; \
139 trade_routes_iterate(c, _proute) \
141 _routes##_saved[_routes##_index++] = _proute; \
143 trade_routes_iterate_end; \
144 for (_routes##_index = 0; _routes##_index < _routes##_size; \
145 _routes##_index++) { \
146 struct trade_route *proute = _routes##_saved[_routes##_index];
148 #define trade_routes_iterate_safe_end \
153 #define trade_partners_iterate(c, p) \
155 trade_routes_iterate(c, _proute_) \
157 struct city *p = game_city_by_number(_proute_->partner); \
163 #define trade_partners_iterate_end \
165 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_COUNT GF_COUNT
177 #define SPECENUM_BITVECTOR bv_goods_flags
178 #include "specenum_gen.h"
185 struct requirement_vector
reqs;
218 #define goods_type_iterate(_p) \
221 for (_i_ = 0; _i_ < game.control.num_goods_types; _i_++) { \
222 struct goods_type *_p = goods_by_number(_i_);
224 #define goods_type_iterate_end \
228 #define goods_type_re_active_iterate(_p) \
229 goods_type_iterate(_p) \
231 if (!_p->ruledit_disabled) {
233 #define goods_type_re_active_iterate_end \
236 goods_type_iterate_end;
static void base(QVariant data1, QVariant data2)
Action "Build Base" for choice dialog.
struct requirement_vector reqs
QVector< QString > * helptext
struct name_translation name
enum traderoute_bonus_type bonus_type
enum traderoute_illegal_cancelling cancelling
struct goods_type * goods
traderoute_illegal_cancelling
struct goods_type * goods_by_number(Goods_type_id id)
Return goods type of given id.
const char * goods_rule_name(struct goods_type *pgood)
Return untranslated name of this goods type.
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
Return TRUE iff the two cities are capable of trade; i.e., if a caravan from one city can enter the o...
enum trade_route_type cities_trade_route_type(const struct city *pcity1, const struct city *pcity2)
What is type of the traderoute between two cities.
int trade_route_type_trade_pct(enum trade_route_type type)
Return percentage bonus for trade route type.
int max_trade_routes(const struct city *pcity)
Return current maximum number of trade routes city can have.
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
Return the trade that exists between these cities, assuming they have a trade route.
enum traderoute_illegal_cancelling traderoute_cancelling_type_by_name(const char *name)
Get traderoute cancelling type by name.
struct goods_type * goods_by_rule_name(const char *name)
Returns goods type matching rule name or nullptr if there is no goods type with such name.
int city_num_trade_routes(const struct city *pcity)
Return number of trade route city has.
Goods_type_id goods_number(const struct goods_type *pgood)
Return the goods id.
const char * goods_name_translation(struct goods_type *pgood)
Return translated name of this goods type.
bool goods_has_flag(const struct goods_type *pgood, enum goods_flag_id flag)
Check if goods has given flag.
void trade_route_types_init()
Initialize trade route types.
struct goods_type * goods_from_city_to_unit(struct city *src, struct unit *punit)
Return goods type for the new traderoute between given cities.
int trade_from_route(const struct city *pc1, const struct trade_route *route, int base)
Get trade income specific to route's good.
struct goods_type * goods_by_translated_name(const char *name)
const char * trade_route_type_name(enum trade_route_type type)
Return human readable name of trade route type.
void goods_init()
Initialize goods structures.
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
Get trade route settings related to type.
Goods_type_id goods_index(const struct goods_type *pgood)
Return the goods index.
void goods_free()
Free the memory associated with goods.
int city_trade_removable(const struct city *pcity, struct trade_route_list *would_remove)
Return the minimum value of the sum of trade routes which could be replaced by a new one.
int get_caravan_enter_city_trade_bonus(const struct city *pc1, const struct city *pc2, const player *seen_as, struct goods_type *pgood, const bool establish_trade)
Returns the revenue trade bonus - you get this when establishing a trade route and also when you simp...
bool can_establish_trade_route(const struct city *pc1, const struct city *pc2)
Returns TRUE iff the two cities can establish a trade route.
bool city_receives_goods(const struct city *pcity, const struct goods_type *pgood)
Does city receive goods.
const char * traderoute_cancelling_type_name(enum traderoute_illegal_cancelling type)
Return human readable name of traderoute cancelling type.
bool goods_can_be_provided(struct city *pcity, struct goods_type *pgood, struct unit *punit)
Can the city provide goods.
enum trade_route_type trade_route_type_by_name(const char *name)
Get trade route type by name.
bool have_cities_trade_route(const struct city *pc1, const struct city *pc2)
Check if cities have an established trade route.