1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Fix broken roads to portals or gates by the lower zone border

This commit is contained in:
Tomasz Zieliński
2024-11-23 08:25:55 +01:00
parent f95bb58433
commit c8fcc6ffca
4 changed files with 3 additions and 5 deletions

View File

@ -24,13 +24,13 @@
VCMI_LIB_NAMESPACE_BEGIN
void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src)
void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src, bool onlyStraight)
{
auto costFunction = rmg::Path::createCurvedCostFunction(zone.area()->getBorder());
auto pathArea = zone.areaForRoads();
rmg::Path curvedPath(pathArea);
curvedPath.connect(zone.freePaths().get());
curvedPath = curvedPath.search(src, false, costFunction);
curvedPath = curvedPath.search(src, onlyStraight, costFunction);
if (curvedPath.valid())
{
path = curvedPath;