Skip to content

Commit

Permalink
Use the Euclidian distance for CLASSIC trade route revenue
Browse files Browse the repository at this point in the history
The CLASSIC trade route revenue style was using map_distance() which is the
Manhattan distance. Using Euclidian makes much more sense since this is how
units move.

Closes longturn#882.
  • Loading branch information
lmoureaux committed Dec 27, 2023
1 parent 434d7ef commit a27a9c9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions common/traderoutes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,23 +449,22 @@ 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

0 comments on commit a27a9c9

Please sign in to comment.