mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Place towns and monoliths first - preferably at the zone border.
This commit is contained in:
parent
045942fd68
commit
5ed3c2d518
@ -236,8 +236,7 @@ rmg::Path ObjectManager::placeAndConnectObject(const rmg::Area & searchArea, rmg
|
||||
bool ObjectManager::createRequiredObjects()
|
||||
{
|
||||
logGlobal->trace("Creating required objects");
|
||||
|
||||
RandomGeneratorUtil::randomShuffle(requiredObjects, generator.rand);
|
||||
|
||||
for(const auto & object : requiredObjects)
|
||||
{
|
||||
auto * obj = object.first;
|
||||
|
@ -157,6 +157,8 @@ bool TownPlacer::placeMines(ObjectManager & manager)
|
||||
{
|
||||
using namespace Res;
|
||||
std::vector<CGMine*> createdMines;
|
||||
|
||||
std::vector<std::pair<CGObjectInstance*, ui32>> requiredObjects;
|
||||
|
||||
for(const auto & mineInfo : zone.getMinesInfo())
|
||||
{
|
||||
@ -175,9 +177,16 @@ bool TownPlacer::placeMines(ObjectManager & manager)
|
||||
if(!i && (res == ERes::WOOD || res == ERes::ORE))
|
||||
manager.addCloseObject(mine, rmginfo.value); //only first wood&ore mines are close
|
||||
else
|
||||
manager.addRequiredObject(mine, rmginfo.value);
|
||||
requiredObjects.push_back(std::pair<CGObjectInstance*, ui32>(mine, rmginfo.value));
|
||||
}
|
||||
}
|
||||
|
||||
//Shuffle mines to avoid patterns, but don't shuffle key objects like towns
|
||||
RandomGeneratorUtil::randomShuffle(requiredObjects, generator.rand);
|
||||
for (const auto& obj : requiredObjects)
|
||||
{
|
||||
manager.addRequiredObject(obj.first, obj.second);
|
||||
}
|
||||
|
||||
//create extra resources
|
||||
if(int extraRes = generator.getConfig().mineExtraResources)
|
||||
|
Loading…
Reference in New Issue
Block a user