1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Spawn quest arts in nearby zones.

This commit is contained in:
DjWarmonger
2015-03-01 10:20:49 +01:00
parent 67ab90616d
commit 9453250e0f
4 changed files with 157 additions and 100 deletions

View File

@@ -241,6 +241,7 @@ void CMapGenerator::fillZones()
it.second->initFreeTiles(this);
}
findZonesForQuestArts();
createConnections();
//make sure all connections are passable before creating borders
for (auto it : zones)
@@ -270,6 +271,26 @@ void CMapGenerator::fillZones()
logGlobal->infoStream() << "Zones filled successfully";
}
void CMapGenerator::findZonesForQuestArts()
{
//we want to place arties in zones that were not yet filled (higher index)
for (auto connection : mapGenOptions->getMapTemplate()->getConnections())
{
auto zoneA = connection.getZoneA();
auto zoneB = connection.getZoneB();
if (zoneA->getId() > zoneB->getId())
{
zoneB->setQuestArtZone(zoneA);
}
else if (zoneA->getId() < zoneB->getId())
{
zoneA->setQuestArtZone(zoneB);
}
}
}
void CMapGenerator::createConnections()
{
for (auto connection : mapGenOptions->getMapTemplate()->getConnections())