mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix diagonal paths if we need to use them
This commit is contained in:
parent
a6fa6855dc
commit
7cb17afe7a
@ -121,17 +121,13 @@ bool RoadPlacer::createRoad(const int3 & dst)
|
||||
}
|
||||
}
|
||||
|
||||
auto ret = dst.dist2d(src);
|
||||
float weight = dst.dist2dSQ(src);
|
||||
auto ret = weight * weight; // Still prefer straight paths
|
||||
|
||||
if (visitableTiles.contains(src) || visitableTiles.contains(dst))
|
||||
{
|
||||
ret *= VISITABLE_PENALTY;
|
||||
}
|
||||
float dist = border.distance(dst);
|
||||
if(dist > 1)
|
||||
{
|
||||
ret /= dist;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
res = path.search(dst, false, desperateRoutig);
|
||||
|
Loading…
Reference in New Issue
Block a user