mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-09 13:14:02 +02:00
Roads are generated between all nodes.
This commit is contained in:
parent
3ec91c550e
commit
353f6dc32e
@ -722,6 +722,7 @@ bool CRmgTemplateZone::createRoad(CMapGenerator* gen, const int3& src, const int
|
||||
std::map<int3, int> distances;
|
||||
|
||||
int3 currentNode = src;
|
||||
gen->setRoad (src, ERoadType::NO_ROAD); //just in case zone guard already has road under it. Road under nodes will be added at very end
|
||||
|
||||
cameFrom[src] = int3(-1, -1, -1); //first node points to finish condition
|
||||
distances[src] = 0;
|
||||
@ -772,14 +773,14 @@ bool CRmgTemplateZone::createRoad(CMapGenerator* gen, const int3& src, const int
|
||||
//if (gen->map->checkForVisitableDir(currentNode, &gen->map->getTile(pos), pos)) //TODO: why it has no effect?
|
||||
if (gen->isFree(pos) || pos == dst || (obj && obj->ID == Obj::MONSTER))
|
||||
{
|
||||
//if (vstd::contains(this->tileinfo, pos))
|
||||
//{
|
||||
if (vstd::contains(this->tileinfo, pos)) //otherwise guard position may appear already connected to other zone.
|
||||
{
|
||||
cameFrom[pos] = currentNode;
|
||||
open.insert(pos);
|
||||
distances[pos] = distance;
|
||||
directNeighbourFound = true;
|
||||
//logGlobal->traceStream() << boost::format("Found connection between node %s and %s, current distance %d") % currentNode % pos % distance;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user