Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Manhattan distances from trade routes #2094

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions common/traderoutes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ bool can_cities_trade(const struct city *pc1, const struct city *pc2)
{
/* If you change the logic here, make sure to update the help in
* helptext_unit(). */
return (
pc1 && pc2 && pc1 != pc2
&& (city_owner(pc1) != city_owner(pc2)
|| map_distance(pc1->tile, pc2->tile) >= game.info.trademindist)
&& (trade_route_type_trade_pct(cities_trade_route_type(pc1, pc2))
> 0));
return (pc1 && pc2 && pc1 != pc2
&& (city_owner(pc1) != city_owner(pc2)
|| real_map_distance(pc1->tile, pc2->tile)
>= game.info.trademindist)
&& (trade_route_type_trade_pct(cities_trade_route_type(pc1, pc2))
> 0));
}

/**
Expand Down Expand Up @@ -449,23 +449,21 @@ int get_caravan_enter_city_trade_bonus(const struct city *pc1,
struct goods_type *pgood,
const bool establish_trade)
{
int md, rmd, trade2, max_trade_2;
int rmd, trade2, max_trade_2;
int tb = 0, bonus = 0;

if (pc2) {
md = map_distance(pc1->tile, pc2->tile);
rmd = real_map_distance(pc1->tile, pc2->tile);
trade2 = pc2->surplus[O_TRADE];
max_trade_2 = max_trade_prod(pc2, seen_as);
} else {
md = rmd = 10;
rmd = 10;
trade2 = pc1->surplus[O_TRADE] * 0.75;
max_trade_2 = max_trade_prod(pc1, seen_as) * 0.75;
}

if (game.info.caravan_bonus_style == CBS_CLASSIC) {
// Should this be real_map_distance (rmd)?
tb = md + 10;
tb = rmd + 10;
tb = (tb * (pc1->surplus[O_TRADE] + trade2)) / 24;
} else if (game.info.caravan_bonus_style == CBS_LOGARITHMIC) {
// Logarithmic bonus
Expand Down
Loading