mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
Fixed underground Lava terrain.
This commit is contained in:
parent
999c2a92e0
commit
a0f534146c
@ -553,10 +553,10 @@ void CDrawTerrainOperation::updateTerrainTypes()
|
|||||||
|
|
||||||
if (putSuitableTile)
|
if (putSuitableTile)
|
||||||
{
|
{
|
||||||
if(!suitableTiles.empty())
|
//if(!suitableTiles.empty())
|
||||||
{
|
//{
|
||||||
logGlobal->debugStream() << "Clear suitables tiles.";
|
// logGlobal->debugStream() << "Clear suitables tiles.";
|
||||||
}
|
//}
|
||||||
|
|
||||||
invalidNativeTilesCnt = nativeTilesCntNorm;
|
invalidNativeTilesCnt = nativeTilesCntNorm;
|
||||||
invalidForeignTilesCnt = testTile.foreignTiles.size();
|
invalidForeignTilesCnt = testTile.foreignTiles.size();
|
||||||
@ -567,9 +567,9 @@ void CDrawTerrainOperation::updateTerrainTypes()
|
|||||||
if (addToSuitableTiles)
|
if (addToSuitableTiles)
|
||||||
{
|
{
|
||||||
suitableTiles.insert(posToTest);
|
suitableTiles.insert(posToTest);
|
||||||
logGlobal->debugStream() << boost::format(std::string("Found suitable tile '%s' for main tile '%s': ") +
|
//logGlobal->debugStream() << boost::format(std::string("Found suitable tile '%s' for main tile '%s': ") +
|
||||||
"Invalid native tiles '%i', invalid foreign tiles '%i', centerPosValid '%i'") % posToTest % centerPos % testTile.nativeTiles.size() %
|
// "Invalid native tiles '%i', invalid foreign tiles '%i', centerPosValid '%i'") % posToTest % centerPos % testTile.nativeTiles.size() %
|
||||||
testTile.foreignTiles.size() % testTile.centerPosValid;
|
// testTile.foreignTiles.size() % testTile.centerPosValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
terrainTile.terType = formerTerType;
|
terrainTile.terType = formerTerType;
|
||||||
|
@ -259,12 +259,14 @@ void CMapGenerator::fillZones()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set apriopriate free/occupied tiles, including blocked underground rock
|
//set apriopriate free/occupied tiles, including blocked underground rock
|
||||||
createObstaclesCommon();
|
createObstaclesCommon1();
|
||||||
|
//set back original terrain for underground zones
|
||||||
|
for (auto it : zones)
|
||||||
|
it.second->createObstacles1(this);
|
||||||
|
createObstaclesCommon2();
|
||||||
//place actual obstacles matching zone terrain
|
//place actual obstacles matching zone terrain
|
||||||
for (auto it : zones)
|
for (auto it : zones)
|
||||||
{
|
it.second->createObstacles2(this);
|
||||||
it.second->createObstacles(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//find place for Grail
|
//find place for Grail
|
||||||
if (treasureZones.empty())
|
if (treasureZones.empty())
|
||||||
@ -279,10 +281,9 @@ void CMapGenerator::fillZones()
|
|||||||
logGlobal->infoStream() << "Zones filled successfully";
|
logGlobal->infoStream() << "Zones filled successfully";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapGenerator::createObstaclesCommon()
|
void CMapGenerator::createObstaclesCommon1()
|
||||||
{
|
{
|
||||||
#define MAKE_COOL_UNDERGROUND_TUNNELS true
|
if (map->twoLevel) //underground
|
||||||
if (map->twoLevel && MAKE_COOL_UNDERGROUND_TUNNELS) //underground
|
|
||||||
{
|
{
|
||||||
//negative approach - create rock tiles first, then make sure all accessible tiles have no rock
|
//negative approach - create rock tiles first, then make sure all accessible tiles have no rock
|
||||||
std::vector<int3> rockTiles;
|
std::vector<int3> rockTiles;
|
||||||
@ -300,24 +301,13 @@ void CMapGenerator::createObstaclesCommon()
|
|||||||
}
|
}
|
||||||
editManager->getTerrainSelection().setSelection(rockTiles);
|
editManager->getTerrainSelection().setSelection(rockTiles);
|
||||||
editManager->drawTerrain(ETerrainType::ROCK, &rand);
|
editManager->drawTerrain(ETerrainType::ROCK, &rand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//now make sure all accessible tiles have no additional rock on them
|
void CMapGenerator::createObstaclesCommon2()
|
||||||
|
{
|
||||||
std::vector<int3> accessibleTiles;
|
if (map->twoLevel)
|
||||||
for (int x = 0; x < map->width; x++)
|
{
|
||||||
{
|
|
||||||
for (int y = 0; y < map->height; y++)
|
|
||||||
{
|
|
||||||
int3 tile(x, y, 1);
|
|
||||||
if (isFree(tile) || isUsed(tile))
|
|
||||||
{
|
|
||||||
accessibleTiles.push_back(tile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
editManager->getTerrainSelection().setSelection(accessibleTiles);
|
|
||||||
editManager->drawTerrain(ETerrainType::SUBTERRANEAN, &rand);
|
|
||||||
|
|
||||||
//finally mark rock tiles as occupied, spawn no obstacles there
|
//finally mark rock tiles as occupied, spawn no obstacles there
|
||||||
for (int x = 0; x < map->width; x++)
|
for (int x = 0; x < map->width; x++)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +110,7 @@ private:
|
|||||||
void initTiles();
|
void initTiles();
|
||||||
void genZones();
|
void genZones();
|
||||||
void fillZones();
|
void fillZones();
|
||||||
void createObstaclesCommon();
|
void createObstaclesCommon1();
|
||||||
|
void createObstaclesCommon2();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1337,7 +1337,26 @@ void CRmgTemplateZone::createTreasures(CMapGenerator* gen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRmgTemplateZone::createObstacles(CMapGenerator* gen)
|
void CRmgTemplateZone::createObstacles1(CMapGenerator * gen)
|
||||||
|
{
|
||||||
|
if (pos.z) //underground
|
||||||
|
{
|
||||||
|
//now make sure all accessible tiles have no additional rock on them
|
||||||
|
|
||||||
|
std::vector<int3> accessibleTiles;
|
||||||
|
for (auto tile : tileinfo)
|
||||||
|
{
|
||||||
|
if (gen->isFree(tile) || gen->isUsed(tile))
|
||||||
|
{
|
||||||
|
accessibleTiles.push_back(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gen->editManager->getTerrainSelection().setSelection(accessibleTiles);
|
||||||
|
gen->editManager->drawTerrain(terrainType, &gen->rand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRmgTemplateZone::createObstacles2(CMapGenerator* gen)
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::vector<ObjectTemplate> obstacleVector;
|
typedef std::vector<ObjectTemplate> obstacleVector;
|
||||||
|
@ -164,7 +164,8 @@ public:
|
|||||||
void fractalize(CMapGenerator* gen);
|
void fractalize(CMapGenerator* gen);
|
||||||
bool createRequiredObjects(CMapGenerator* gen);
|
bool createRequiredObjects(CMapGenerator* gen);
|
||||||
void createTreasures(CMapGenerator* gen);
|
void createTreasures(CMapGenerator* gen);
|
||||||
void createObstacles(CMapGenerator* gen);
|
void createObstacles1(CMapGenerator* gen);
|
||||||
|
void createObstacles2(CMapGenerator* gen);
|
||||||
bool crunchPath (CMapGenerator* gen, const int3 &src, const int3 &dst, TRmgTemplateZoneId zone, std::set<int3>* clearedTiles = nullptr);
|
bool crunchPath (CMapGenerator* gen, const int3 &src, const int3 &dst, TRmgTemplateZoneId zone, std::set<int3>* clearedTiles = nullptr);
|
||||||
std::vector<int3> getAccessibleOffsets (CMapGenerator* gen, CGObjectInstance* object);
|
std::vector<int3> getAccessibleOffsets (CMapGenerator* gen, CGObjectInstance* object);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user