I managed to pinpoint the reason for the bug. It was in the function MapDistanceTo(const CUnit &dst) in unit.h. Here is a fixed version of the function:
int MapDistanceTo(const CUnit &dst) const { const CUnitType *distance_unit_type = Container ? Container->Type : Type; return MapDistanceBetweenTypes(*distance_unit_type, tilePos, *dst.Type, dst.tilePos); }
I have tested it and can confirm this fix works.
I managed to pinpoint the reason for the bug. It was in the function MapDistanceTo(const CUnit &dst) in unit.h. Here is a fixed version of the function:
int MapDistanceTo(const CUnit &dst) const eenTypes( *distance_ unit_type, tilePos, *dst.Type, dst.tilePos);
{
const CUnitType *distance_unit_type = Container ? Container->Type : Type;
return MapDistanceBetw
}
I have tested it and can confirm this fix works.