1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Implemented "junction" zone type.

This commit is contained in:
DjWarmonger
2015-01-16 17:39:16 +01:00
parent b7386250e9
commit ba604f4e43
2 changed files with 46 additions and 40 deletions

View File

@ -8,6 +8,7 @@ BATTLES:
* Implemented OH3 stack split / upgrade formulas according to AlexSpl * Implemented OH3 stack split / upgrade formulas according to AlexSpl
RANDOM MAP GENERATOR: RANDOM MAP GENERATOR:
* Implemented "junction" zone type
* Improved zone placing algorithm * Improved zone placing algorithm
* More balanced distribution of treasure piles * More balanced distribution of treasure piles
* More obstacles within zones * More obstacles within zones

View File

@ -429,6 +429,10 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
} }
assert (clearedTiles.size()); //this should come from zone connections assert (clearedTiles.size()); //this should come from zone connections
if (type != ETemplateZoneType::JUNCTION)
{
//junction is not fractalized, has only one straight path
//everything else remains blocked
while (possibleTiles.size()) while (possibleTiles.size())
{ {
//link tiles in random order //link tiles in random order
@ -439,7 +443,7 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
{ {
//find closest free tile //find closest free tile
float currentDistance = 1e10; float currentDistance = 1e10;
int3 closestTile (-1,-1,-1); int3 closestTile(-1, -1, -1);
for (auto clearTile : clearedTiles) for (auto clearTile : clearedTiles)
{ {
@ -453,14 +457,14 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
if (currentDistance <= minDistance) if (currentDistance <= minDistance)
{ {
//this tile is close enough. Forget about it and check next one //this tile is close enough. Forget about it and check next one
tilesToIgnore.insert (tileToMakePath); tilesToIgnore.insert(tileToMakePath);
break; break;
} }
} }
//if tiles is not close enough, make path to it //if tiles is not close enough, make path to it
if (currentDistance > minDistance) if (currentDistance > minDistance)
{ {
crunchPath (gen, tileToMakePath, closestTile, id, &tilesToClear); crunchPath(gen, tileToMakePath, closestTile, id, &tilesToClear);
break; //next iteration - use already cleared tiles break; //next iteration - use already cleared tiles
} }
} }
@ -481,6 +485,7 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
tilesToClear.clear(); //empty this container tilesToClear.clear(); //empty this container
tilesToIgnore.clear(); tilesToIgnore.clear();
} }
}
for (auto tile : clearedTiles) for (auto tile : clearedTiles)
{ {