mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Generate Grail to not crash at Obelisks.
This commit is contained in:
parent
5cb6eaa252
commit
e3d968e284
@ -257,10 +257,24 @@ void CMapGenerator::fillZones()
|
||||
//we need info about all town types to evaluate dwellings and pandoras with creatures properly
|
||||
it.second->initTownType(this);
|
||||
}
|
||||
std::vector<CRmgTemplateZone*> treasureZones;
|
||||
for (auto it : zones)
|
||||
{
|
||||
it.second->fill(this);
|
||||
}
|
||||
if (it.second->getType() == ETemplateZoneType::TREASURE)
|
||||
treasureZones.push_back(it.second);
|
||||
}
|
||||
|
||||
//find place for Grail
|
||||
if (treasureZones.empty())
|
||||
{
|
||||
for (auto it : zones)
|
||||
treasureZones.push_back(it.second);
|
||||
}
|
||||
auto grailZone = *RandomGeneratorUtil::nextItem(treasureZones, rand);
|
||||
|
||||
map->grailPos = *RandomGeneratorUtil::nextItem(*grailZone->getFreePaths(), rand);
|
||||
|
||||
logGlobal->infoStream() << "Zones filled successfully";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user