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

- Fixed several legacy issues with map templates

- Added Clash of Dragons 1.2 template
- Temporarily disabled exception when RMG runs out of two-way monoliths (exception was not handled anyway)
This commit is contained in:
DjWarmonger
2014-10-30 21:23:25 +01:00
parent ce83db0f43
commit 697e42dd24
2 changed files with 17 additions and 19 deletions

View File

@@ -211,27 +211,15 @@ void CMapGenerator::genZones()
auto w = mapGenOptions->getWidth();
auto h = mapGenOptions->getHeight();
auto tmpl = mapGenOptions->getMapTemplate();
zones = tmpl->getZones(); //copy from template (refactor?)
int player_per_side = zones.size() > 4 ? 3 : 2;
logGlobal->infoStream() << boost::format("Map size %d %d, players per side %d") % w % h % player_per_side;
CZonePlacer placer(this);
placer.placeZones(mapGenOptions, &rand);
placer.assignZones(mapGenOptions);
int i = 0;
for(auto const it : zones)
{
CRmgTemplateZone * zone = it.second;
zone->setType(i < pcnt ? ETemplateZoneType::PLAYER_START : ETemplateZoneType::TREASURE);
this->zones[it.first] = zone;
++i;
}
logGlobal->infoStream() << "Zones generated successfully";
}
@@ -484,7 +472,13 @@ float CMapGenerator::getNearestObjectDistance(const int3 &tile) const
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));
{
logGlobal->errorStream() << boost::to_string(boost::format("RMG Error! There is no Monolith Two Way with index %d available!") % monolithIndex);
monolithIndex++;
return VLC->objtypeh->knownSubObjects(Obj::MONOLITH_TWO_WAY).size() - 1;
//TODO: interrupt map generation and report error
//throw rmgException(boost::to_string(boost::format("There is no Monolith Two Way with index %d available!") % monolithIndex));
}
else
return monolithIndex++;
}