1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

- Remove obstacle in front of player-owned towns

- Allow obstacles to touch town object
This commit is contained in:
DjWarmonger
2016-12-20 15:23:47 +01:00
parent e37c35e439
commit f78b524731
3 changed files with 26 additions and 27 deletions

View File

@ -283,7 +283,12 @@ void CMapGenerator::fillZones()
logGlobal->infoStream() << "Started filling zones";
//initialize possible tiles before any object is actually placed
//we need info about all town types to evaluate dwellings and pandoras with creatures properly
//place main town in the middle
for (auto it : zones)
it.second->initTownType(this);
//make sure there are some free tiles in the zone
for (auto it : zones)
it.second->initFreeTiles(this);
@ -294,10 +299,6 @@ void CMapGenerator::fillZones()
createConnections2(); //subterranean gates and monoliths
//we need info about all town types to evaluate dwellings and pandoras with creatures properly
for (auto it : zones)
it.second->initTownType(this);
std::vector<CRmgTemplateZone*> treasureZones;
for (auto it : zones)
{
@ -532,12 +533,16 @@ void CMapGenerator::createDirectConnections()
guardPos = tile;
if (guardPos.valid())
{
setOccupied(guardPos, ETileType::FREE); //just in case monster is too weak to spawn
zoneA->addMonster(this, guardPos, connection.getGuardStrength(), false, true);
zoneB->updateDistances(this, guardPos); //place next objects away from guard in both zones
//zones can make paths only in their own area
zoneA->crunchPath(this, guardPos, posA, true, zoneA->getFreePaths()); //make connection towards our zone center
zoneB->crunchPath(this, guardPos, posB, true, zoneB->getFreePaths()); //make connection towards other zone center
zoneA->connectWithCenter(this, guardPos, true);
zoneB->connectWithCenter(this, guardPos, true);
bool monsterPresent = zoneA->addMonster(this, guardPos, connection.getGuardStrength(), false, true);
zoneB->updateDistances(this, guardPos); //place next objects away from guard in both zones
//set free tile only after connection is made to the center of the zone
if (!monsterPresent)
setOccupied(guardPos, ETileType::FREE); //just in case monster is too weak to spawn
zoneA->addRoadNode(guardPos);
zoneB->addRoadNode(guardPos);