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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user