33 "National",
"NationalIC",
"IN",
"INIC",
"Ally",
"AllyIC",
34 "Enemy",
"EnemyIC",
"Team",
"TeamIC"
38 "Active",
"Inactive",
"Cancel"
59 const struct city *pcity2)
218 return (pc1 && pc2 && pc1 != pc2
232 struct trade_route_list *would_remove)
240 for (j = num; j > 0 && (proute->value < sorted[j - 1]->
value) ; j--) {
241 sorted[j] = sorted[j - 1];
259 for (i = j = 0; i < num; i++) {
260 j += sorted[i]->
value;
261 if (NULL != would_remove) {
262 trade_route_list_append(would_remove, sorted[i]);
281 if (!pc1 || !pc2 || pc1 == pc2
326 if (NULL == pc1 || NULL == pc1->
tile || NULL == pc2 || NULL == pc2->
tile) {
333 int weighted_distance
338 bonus = weighted_distance
363 if (route->
dir == RDIR_TO) {
385 return trade_route_list_size(pcity->
routes);
393 return *(
int *)a < *(
int *)b;
408 if (pcity->
tile == NULL) {
434 for (i = 0; i < pcity->
size && i <
size; i++) {
435 total += tile_trade[i];
468 const struct city *pc2,
470 const bool establish_trade)
472 int tb = 0, bonus = 0;
475 if (
trtss[trtype].bonus_type == TBONUS_NONE) {
486 tb = weighted_distance + 10;
495 tb = pow(log(weighted_distance + 20
521 EFT_TRADE_REVENUE_BONUS);
524 tb = ceil((
float)tb * pow(2.0, (
double)bonus / 1000.0));
535 if (route_to->id == pc2->
id) {
553 requirement_vector_init(&(
goods[i].
reqs));
567 requirement_vector_free(&(
goods[i].
reqs));
569 if (NULL !=
goods[i].helptext) {
596 return pgood -
goods;
695 if (proute->goods == pgood
696 && (proute->dir == RDIR_TO || proute->dir == RDIR_BIDIRECTIONAL)) {
727 potential[i++] = pgood;
static struct action * action_by_number(action_id act_id)
#define BV_ISSET(bv, bit)
bool base_city_celebrating(const struct city *pcity)
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
int city_map_radius_sq_get(const struct city *pcity)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
int city_map_tiles(int city_radius_sq)
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
#define city_tile(_pcity_)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
#define city_map_iterate_end
#define city_map_iterate(_radius_sq, _index, _x, _y)
#define is_free_worked_index(city_tile_index)
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
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct player *other_player, enum effect_type effect_type)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
struct city * game_city_by_number(int id)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
int map_distance(const struct tile *tile0, const struct tile *tile1)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
static struct setting settings[]
#define CLIP(lower, current, upper)
void strvec_destroy(struct strvec *psv)
struct trade_route_list * routes
struct packet_ruleset_control control
struct packet_game_info info
struct requirement_vector reqs
struct name_translation name
enum trade_revenue_style trade_revenue_style
enum caravan_bonus_style caravan_bonus_style
struct goods_type * goods
int fc_strcasecmp(const char *str0, const char *str1)
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)
const char * trade_route_cancelling_type_names[]
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)
static struct goods_type goods[MAX_GOODS_TYPES]
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)
static int max_tile_trade(const struct city *pcity)
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
struct trade_route_settings trtss[TRT_LAST]
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)
static int best_value(const void *a, const void *b)
struct goods_type * goods_by_translated_name(const char *name)
int get_caravan_enter_city_trade_bonus(const struct city *pc1, const struct city *pc2, struct goods_type *pgood, const bool establish_trade)
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 city_receives_goods(const struct city *pcity, const struct goods_type *pgood)
bool goods_can_be_provided(struct city *pcity, struct goods_type *pgood, struct unit *punit)
const char * trade_route_type_names[]
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)
#define goods_type_iterate_end
trade_route_illegal_cancelling
#define goods_type_iterate(_p)
#define trade_routes_iterate_end
#define trade_partners_iterate_end
#define trade_routes_iterate(c, proute)
#define trade_partners_iterate(c, p)
const struct unit_type * unit_type_get(const struct unit *punit)