1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

- Duplicate Monolith templates to ensure at least 100 are available to RMG

- Do not use Monoliths which can't be placed at any land
This commit is contained in:
Tomasz Zieliński
2023-03-16 06:58:25 +01:00
parent 6c693f2920
commit 5b267f9cbd
4 changed files with 59 additions and 7 deletions

View File

@ -367,10 +367,24 @@ void CMapGenerator::addHeaderInfo()
int CMapGenerator::getNextMonlithIndex()
{
if (monolithIndex >= VLC->objtypeh->knownSubObjects(Obj::MONOLITH_TWO_WAY).size())
throw rmgException(boost::to_string(boost::format("There is no Monolith Two Way with index %d available!") % monolithIndex));
else
return monolithIndex++;
while (true)
{
if (monolithIndex >= VLC->objtypeh->knownSubObjects(Obj::MONOLITH_TWO_WAY).size())
throw rmgException(boost::to_string(boost::format("There is no Monolith Two Way with index %d available!") % monolithIndex));
else
{
//Skip modded Monoliths which can't beplaced on every terrain
auto templates = VLC->objtypeh->getHandlerFor(Obj::MONOLITH_TWO_WAY, monolithIndex)->getTemplates();
if (templates.empty() || !templates[0]->canBePlacedAtAnyTerrain())
{
monolithIndex++;
}
else
{
return monolithIndex++;
}
}
}
}
int CMapGenerator::getPrisonsRemaning() const