Index: src/economy.cpp
===================================================================
--- src/economy.cpp (revision 27655)
+++ src/economy.cpp (working copy)
@@ -1109,7 +1109,7 @@
st->town->received[cs->town_effect].new_act += accepted;
/* Determine profit */
- Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);
+ Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan_dp_(source_tile, st->xy), days_in_transit, cargo_type);
/* Update the cargo monitor. */
AddCargoDelivery(cargo_type, company->index, accepted, src_type, src, st);
@@ -1230,7 +1230,7 @@
Money profit = GetTransportedGoodsIncome(
count,
/* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */
- DistanceManhattan(cp->LoadedAtXY(), Station::Get(this->current_station)->xy),
+ DistanceManhattan_dp_(cp->LoadedAtXY(), Station::Get(this->current_station)->xy),
cp->DaysInTransit(),
this->ct);
Index: src/map.cpp
===================================================================
--- src/map.cpp (revision 27655)
+++ src/map.cpp (working copy)
@@ -163,6 +163,12 @@
return dx + dy;
}
+uint DistanceManhattan_dp_(TileIndex t0, TileIndex t1)
+{
+ const uint dx = Delta(TileX(t0), TileX(t1));
+ const uint dy = Delta(TileY(t0), TileY(t1));
+ return 2 * minu(dx, dy) + 3 * Delta(dx, dy) / 2;
+}
/**
* Gets the 'Square' distance between the two given tiles.
Index: src/map_func.h
===================================================================
--- src/map_func.h (revision 27655)
+++ src/map_func.h (working copy)
@@ -327,6 +327,7 @@
/* Functions to calculate distances */
uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
+uint DistanceManhattan_dp_(TileIndex, TileIndex); ///< _dp_
uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared
uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan