1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Editor prerequisites [part 2] (#889)

This commit is contained in:
Nordsoft91
2022-09-17 15:04:01 +04:00
committed by GitHub
parent 736962a79c
commit e4ac0d4370
31 changed files with 1848 additions and 1281 deletions

View File

@@ -121,15 +121,20 @@ void CMapGenerator::initQuestArtsRemaining()
std::unique_ptr<CMap> CMapGenerator::generate()
{
Load::Progress::reset();
Load::Progress::setupStepsTill(5, 30);
try
{
addHeaderInfo();
map->initTiles(*this);
Load::Progress::step();
initPrisonsRemaining();
initQuestArtsRemaining();
genZones();
Load::Progress::step();
map->map().calculateGuardingGreaturePositions(); //clear map so that all tiles are unguarded
map->addModificators();
Load::Progress::step(3);
fillZones();
//updated guarded tiles will be calculated in CGameState::initMapObjects()
map->getZones().clear();
@@ -138,6 +143,7 @@ std::unique_ptr<CMap> CMapGenerator::generate()
{
logGlobal->error("Random map generation received exception: %s", e.what());
}
Load::Progress::finish();
return std::move(map->mapInstance);
}
@@ -284,13 +290,15 @@ void CMapGenerator::fillZones()
//we need info about all town types to evaluate dwellings and pandoras with creatures properly
//place main town in the middle
Load::Progress::setupStepsTill(map->getZones().size(), 50);
for(auto it : map->getZones())
{
it.second->initFreeTiles();
it.second->initModificators();
Progress::Progress::step();
}
Load::Progress::setupStepsTill(map->getZones().size(), 240);
std::vector<std::shared_ptr<Zone>> treasureZones;
for(auto it : map->getZones())
{
@@ -298,6 +306,8 @@ void CMapGenerator::fillZones()
if (it.second->getType() == ETemplateZoneType::TREASURE)
treasureZones.push_back(it.second);
Progress::Progress::step();
}
//find place for Grail
@@ -312,6 +322,8 @@ void CMapGenerator::fillZones()
map->map().grailPos = *RandomGeneratorUtil::nextItem(grailZone->freePaths().getTiles(), rand);
logGlobal->info("Zones filled successfully");
Load::Progress::set(250);
}
void CMapGenerator::findZonesForQuestArts()