#### onedreamer

##### Dragon

Code:

```
def calculateDistance(self, x1, y1, x2, y2):
dx = abs(x2-x1)
dy = abs(y2-y1)
return max(dx, dy)
```

But there is already a function in Civ4 to calculate plot distances that does take into account both the x and y axis. Two diagonal moves will count 3, the first will count 1 and the second will count 2, just like in Dungeons&Dragons. Here's the formula:

Code:

```
inline int plotDistance(int iX1, int iY1, int iX2, int iY2)
{
iDX = xDistance(iX1, iX2);
iDY = yDistance(iY1, iY2);
return (std::max(iDX, iDY) + (std::min(iDX, iDY) / 2));
}
```

In the example above, distance would be 9 (7+ 4/2). plotDistance is used to calculate Trade Routes base values.

What do you think about using the second formula?