mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
Place towns and monoliths first - preferably at the zone border.
This commit is contained in:
parent
045942fd68
commit
5ed3c2d518
@ -237,7 +237,6 @@ bool ObjectManager::createRequiredObjects()
|
||||
{
|
||||
logGlobal->trace("Creating required objects");
|
||||
|
||||
RandomGeneratorUtil::randomShuffle(requiredObjects, generator.rand);
|
||||
for(const auto & object : requiredObjects)
|
||||
{
|
||||
auto * obj = object.first;
|
||||
|
@ -158,6 +158,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())
|
||||
{
|
||||
ERes res = static_cast<ERes>(mineInfo.first);
|
||||
@ -175,10 +177,17 @@ 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